Hi,
I am struggling with the below code. every time i run it, it shoes me an error called (run-time error "429": ActiveX component can't create object). Is this because i do not have an outlook in my laptop? how can i make the below code works with Hotmail? how can i make VBA send the workbook i am working on via hotmail in my laptop? What changes i need to make below ? I have an excel 2019. Many thanks.
Sub Mail_workbook_Outlook_1()
'This example send the last saved version of the Activeworkbook
'For Tips see: Excel Automation - Ron de Bruin
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I am struggling with the below code. every time i run it, it shoes me an error called (run-time error "429": ActiveX component can't create object). Is this because i do not have an outlook in my laptop? how can i make the below code works with Hotmail? how can i make VBA send the workbook i am working on via hotmail in my laptop? What changes i need to make below ? I have an excel 2019. Many thanks.
Sub Mail_workbook_Outlook_1()
'This example send the last saved version of the Activeworkbook
'For Tips see: Excel Automation - Ron de Bruin
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub