【发布时间】:2015-10-05 13:00:19
【问题描述】:
我使用“ThisOutlookSession”和表单“UserFormWorkTime”。
使用 Outlook 2010,我没有遇到任何问题。但现在使用 Outlook 2013, 我收到以下错误:
这是我的代码:
'Benutzername für E-Mail auslesen
'MsgBox Session.Accounts.Item(1).UserName
Var = Split(Session.Accounts.Item(1).UserName, ".")
Vorname = Var(0)
Name = Var(1)
' E-Mail erstellen und anzeigen
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
If TextBoxInputWorkStart = "" Then
With objMail
.To = TextBoxInputTo
.CC = TextBoxInputCC
.Subject = "Arbeitszeit " + TextBoxInputDate + ""
.HTMLBody = "Sehr geehrte Damen und Herren," & "<br><br>" & "aufgrund " & TextBoxInputReason & " war keine Zeiterfassung möglich." & "<br><br>" & "Ende: " & TextBoxInputWorkEnd & "<br><br>" & "Vielen Dank für das Eintragen" & "<br>" & Vorname & " " & Name
' A dialog box is open. Close it and try again => avoid this error, display it modelessly
Unload Me
objMail.Display
End With
【问题讨论】:
-
这条信息用英文怎么说?似乎这是
.To = TextBoxInputTo有问题的行,您是否在代码的前面正确声明了objMail并且没有发布该部分? -
是的,我在 ThisOutlookSession 中声明了它: UserFormWorkTime.TextBoxInputTo.Text = "test@test.de" UserFormWorkTime.TextBoxInputCC.Text = "test@test.de;test2@test.de"跨度>
标签: vba outlook outlook-2010