N
Norm
Good Morning,
I'm new to this and I'm trying to get an excel spreadsheet to send an email
out to a distribution list I have and went to rondebruin site and put this
program to use:
Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "(e-mail address removed)"
.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 get the following msg below when running it:
Set xlApp = New Excel.Application
xlApp.DisplayAlerts = False
xlApp.Interactive = False
Set xlBook = xlApp.Workbooks.Open(varGetFileName, 0)
(message occurs upon execution of the above line)
I'm new to this and I'm trying to get an excel spreadsheet to send an email
out to a distribution list I have and went to rondebruin site and put this
program to use:
Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "(e-mail address removed)"
.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 get the following msg below when running it:
Set xlApp = New Excel.Application
xlApp.DisplayAlerts = False
xlApp.Interactive = False
Set xlBook = xlApp.Workbooks.Open(varGetFileName, 0)
(message occurs upon execution of the above line)