All,
I am working on an Excel Macro to email the related workbook and would like to allow the user the option of attaching an additional file (probably a PDF) to the email before sending it. Please see the code below and attached excel spreadsheet.
Sub Send_Worksheet_as_Email()
Dim email As String
Dim attachment As String
email = InputBox("Please enter the Email address you want to send to:", "Enter Email")
'Change email address as required
MsgBox "Would you like to add an attachment?", vbQuestion + vbYesNo
If vbQuestion = vbYes Then
ChooseDirectory:
ActiveWorkbook.SendMail Recipients:="" & email
With ActiveWorkbook.MailEnvelope.Attachments.Add
attachment = Application.GetOpenFilename
If attachment Like "Enter The Attachment Name Here." Then
MsgBox "Please enter your attachment's name here."
GoTo ChooseDirectory
End If
End With
Else
End If
MsgBox "You have sent the completed REQUEST FOR INFORMATION to the following address: " & email
End Sub
Bookmarks