C
Chaplain Doug
I am trying to attach a file to email I am sending via the code below.
Unfortunately, assigning a file name to .Attachments does not do it. Can
anyone tell me how to make this work? Thanks.
Sub Send_Message(Recipients As String, BodyText As String)
'You must add a reference to the Microsoft outlook Library
On Error GoTo SE_Err
Dim source As Range
Dim dest As Workbook
Dim myshape As Shape
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set source = Nothing
On Error Resume Next
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "(e-mail address removed)"
'.To = Recipients
.CC = ""
.BCC = ""
.Subject = "2005 Budget Adjustments Explanation"
.Body = BodyText
'.HTMLBody = RangetoHTML
.Attachments = "C:\Documents and Settings\doug.GNJPM\My
Documents\Excel\Development\2005 Budget Certification Form.doc"
.Send 'or use .Display
End With
SE_Exit:
Set OutMail = Nothing
Set OutApp = Nothing
Set dest = Nothing
Application.ScreenUpdating = True
Exit Sub
SE_Err:
Print Error(Err.Number) ' print error message.
'Resume Next
GoTo SE_Exit
End Sub
Unfortunately, assigning a file name to .Attachments does not do it. Can
anyone tell me how to make this work? Thanks.
Sub Send_Message(Recipients As String, BodyText As String)
'You must add a reference to the Microsoft outlook Library
On Error GoTo SE_Err
Dim source As Range
Dim dest As Workbook
Dim myshape As Shape
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set source = Nothing
On Error Resume Next
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "(e-mail address removed)"
'.To = Recipients
.CC = ""
.BCC = ""
.Subject = "2005 Budget Adjustments Explanation"
.Body = BodyText
'.HTMLBody = RangetoHTML
.Attachments = "C:\Documents and Settings\doug.GNJPM\My
Documents\Excel\Development\2005 Budget Certification Form.doc"
.Send 'or use .Display
End With
SE_Exit:
Set OutMail = Nothing
Set OutApp = Nothing
Set dest = Nothing
Application.ScreenUpdating = True
Exit Sub
SE_Err:
Print Error(Err.Number) ' print error message.
'Resume Next
GoTo SE_Exit
End Sub