Hi, Thanks for the replies so far. I still have this issue.
There's a function which I used to check if Outlook is running which currently returns False even when Outlook 365 is running.
Function isOutLookRunning() As Boolean
Dim olApp As Object
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If Not olApp Is Nothing Then
isOutLookRunning = True
Else
isOutLookRunning = False
End If
End Function
If this returns true, then the main part of the code creates an email for the user to edit.
Sub createMail()
Dim OutApp As Object
Dim OutMail As Object
Dim sSubject As String
Dim sBody As String
Dim Signature
If isOutLookRunning = True Then
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
sSubject = "A subject"
sBody = "Hi"
With OutMail
.display
.To = "mainrecipient"
.CC = "CCrecipients"
.body = sBody
.Subject = sSubject
End With
Set OutApp = Nothing
Set OutMail = Nothing
End If
End Sub
Bookmarks