caillebotte
IS-IT--Management
Can you program an Excel macro to email a file (not the active worksheet)?
If so, can I see a simple coding example?
Thanks.
Caillebotte
If so, can I see a simple coding example?
Thanks.
Caillebotte
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub Send_Email()
' Be Sure to set a reference to MS Outlook before using this procedure.
' Go to Tools->References and select the Outlook library from the list and press OK.
Dim newOL As New outlook.Application
Dim newMail As MailItem
Set newOL = New outlook.Application
Set newMail = newOL.CreateItem(olMailItem)
With newMail
.To = "noone@nowhere.com"
.Subject = "This is a Test"
.Body = "This is a test Email sent to you from Excel. " & _
"Please, do not reply to this Email."
.Attachments.Add Source:="EnterPath_And_FileName"
.Display ' This will display the Email for editing
' .Send ' This will send the Email directly
End With
Set newMail = Nothing
Set newOL = Nothing
End Sub