Hallo, ich habe eine Public Function in eines der Foren gefunden um Outlook 2019 zu öffnen. Der Aufruf funktionert, jedoch wird Outlook minimiert gestartet. Wie kann ich Outlook nun Outlook per VBA Maximized darstellen?
Danke für jede Hilfe
Vittorio0
Public Function SendOutlook(sSubject As String, sTo As String, Optional sCC As String, Optional sBcc As String, Optional sBody As String, Optional sAttachment As String, Optional sAttachment1 As String, Optional sAttachment2 As String)
'Only working in Office 2007 and higher
'Don't forget to set a reference to Outlook in the VBA editor
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim OutAccount As Outlook.Account
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")` Set OutMail = OutApp.CreateItem(olMailItem)
'Use the first account, see that Item is 1 now
'Set OutAccount = OutApp.Session.Accounts.Item(1)
'Or use the name instead of the number
Set OutAccount = OutApp.Session.Accounts("email@email.com")
sBody = ""
OutMail.Attachments.Add (sAttachment)
On Error Resume Next
With OutMail
.To = sTo
.CC = sCC
.BCC = ""
.Subject = sSubject
.HTMLBody = sBody
.SendUsingAccount = OutAccount
.Display 'or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Set OutAccount = Nothing
End Function
|