I currently have a vba code that is activated by a button in excel that copies certain information from the sheet into an outlook email. Having updated to win64 and updating the declare statements etc. I can not get it to open an outlook email window. What is the new code to open the outlook application window from within excel via win64
Asked
Active
Viewed 157 times
0
-
Can you post your current code please – 0m3r May 13 '22 at 07:14
-
Please provide enough code so others can better understand or reproduce the problem. – Community May 13 '22 at 09:12
1 Answers
1
The following code works like a charm on my machine with Office x64 installed:
Dim applOL As Outlook.Application
Dim miOL As Outlook.MailItem
'Create a new instance of the Outlook application. Set the Application object as follows:
Set applOL = New Outlook.Application
'create mail item:
Set miOL = applOL.CreateItem(olMailItem)
With miOL
.To = "name@domain.com"
.Subject = "Mail Automation"
.Body = "Sending the Active Excel Workbook as attachment!"
'add host workbook as an attachment to the mail:
.Attachments.Add ActiveWorkbook.FullName
.Display
End With
'clear the object variables:
Set applOL = Nothing
Set miOL = Nothing
Don't forget to add an Outlook COM reference in your VBA environment.
Also you may find the following articles helpful:
- How To: Create and send an Outlook message programmatically
- How To: Fill TO,CC and BCC fields in Outlook programmatically
Also take a look at the Automating Outlook from Other Office Applications article.

Eugene Astafiev
- 47,483
- 3
- 24
- 45