I use "ThisOutlookSession" and a form "UserFormWorkTime".
With Outlook 2010 I had no problems. But now with Outlook 2013, I get the following error:
Here is my code:
'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
Use the Recipients property of the MailItem class to add recipients. The Add method of the Recipients class creates a new recipient in the Recipients collection. The Type property of a new Recipient object is set to the default value for the associated AppointmentItem, JournalItem, MailItem, MeetingItem, or TaskItem object and must be reset to indicate another recipient type.
Set myItem = Application.CreateItem(olMailItem)
Set myRecipient = myItem.Recipients.Add ("Eugene Astafiev")
myRecipient.Type = olCC
Don't forget to use the Resolve or ResolveAll methods of the Recipient(s) class to get recipients resolved against the address book.
Do you get any exceptions or errors in the code?