我要在OUTLOOK中设置自动签名,在网上找了段VB的方法,以前用OUTLOOK2010的时候是正常使用这个方法的,现在用2013的时候出现了 错误429,不能创建对象的错误。具体出现错误的是这样一行。该怎么办呢标黄的地方显示 对象变量或WITH块变量未设置 以前用OFFICE2010的时候没有这个错误的 用的WIN7系统1 '------------------------------------------------------------------
2
3 Dim myOlApp As New Outlook.Application
4
5 Private WithEvents myOlInspectors As Outlook.Inspectors
6
7 Private myMailItem As Outlook.MailItem
8
9 Function Signature() As String
10
11 Dim mDate As Date
12
13 mDate = Format(Now, "yyyy-MM-dd")
14
15 Signature = "<font size=2>"
16
17 Signature = Signature & "<p> </p>"
18
19 Signature = Signature & "<p style=""""font-size: 10px"""">自动签名添加日期
<br />" & mDate & " <br />"
20
21 Signature = Signature & "自动签名添加日期成功</p>"
22
23
24 Signature = Signature & "</font> "
25
26 End Function
27
28 Private Sub Application_Startup()
29
30 'GetSignature
31
32 Set myOlInspectors = myOlApp.Inspectors 就是这一行出现错误了,大神看这里啊。
33
34 End Sub
35
36 Private Sub myOlInspectors_NewInspector(ByVal Inspector As Inspector)
37
38 Set myMailItem = Inspector.CurrentItem
39
40 With myMailItem
41
42 .HTMLBody = Signature()
43
44 '.Display
45
46 End With
47
48 End Sub
49
50 '------------------------------------------------------------------------
----------
2
3 Dim myOlApp As New Outlook.Application
4
5 Private WithEvents myOlInspectors As Outlook.Inspectors
6
7 Private myMailItem As Outlook.MailItem
8
9 Function Signature() As String
10
11 Dim mDate As Date
12
13 mDate = Format(Now, "yyyy-MM-dd")
14
15 Signature = "<font size=2>"
16
17 Signature = Signature & "<p> </p>"
18
19 Signature = Signature & "<p style=""""font-size: 10px"""">自动签名添加日期
<br />" & mDate & " <br />"
20
21 Signature = Signature & "自动签名添加日期成功</p>"
22
23
24 Signature = Signature & "</font> "
25
26 End Function
27
28 Private Sub Application_Startup()
29
30 'GetSignature
31
32 Set myOlInspectors = myOlApp.Inspectors 就是这一行出现错误了,大神看这里啊。
33
34 End Sub
35
36 Private Sub myOlInspectors_NewInspector(ByVal Inspector As Inspector)
37
38 Set myMailItem = Inspector.CurrentItem
39
40 With myMailItem
41
42 .HTMLBody = Signature()
43
44 '.Display
45
46 End With
47
48 End Sub
49
50 '------------------------------------------------------------------------
----------
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货