Hello, I found this macro on the web that I like but I want to do some modifications to it and I dont know how.
Instead of a direct email I want the macro to open outlook email and give me the chance to add more info if I need it.
Any help will be appreciated. I would like to keep the .PDF format please
Sub SendWorkSheetToPDF()
'Update 20131209
Dim Wb As Workbook
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
On Error Resume Next
Set Wb = Application.ActiveWorkbook
FileName = Wb.FullName
xIndex = VBA.InStrRev(FileName, ".")
If xIndex > 1 Then FileName = VBA.Left(FileName, xIndex - 1)
FileName = FileName & "_" + ActiveSheet.Name & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
With OutlookMail
.To = "macro@test.com"
.CC = ""
.BCC = ""
.Subject = "TESTING EMAIL"
.Body = "To All" & vbNewLine & _
"Please find attached FILE." & vbNewLine & _
"If you have any question, Please feel free to contact me" & vbNewLine & _
"Regards"
.Attachments.Add FileName
.Send
End With
Kill FileName
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub
Instead of a direct email I want the macro to open outlook email and give me the chance to add more info if I need it.
Any help will be appreciated. I would like to keep the .PDF format please
Sub SendWorkSheetToPDF()
'Update 20131209
Dim Wb As Workbook
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
On Error Resume Next
Set Wb = Application.ActiveWorkbook
FileName = Wb.FullName
xIndex = VBA.InStrRev(FileName, ".")
If xIndex > 1 Then FileName = VBA.Left(FileName, xIndex - 1)
FileName = FileName & "_" + ActiveSheet.Name & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
With OutlookMail
.To = "macro@test.com"
.CC = ""
.BCC = ""
.Subject = "TESTING EMAIL"
.Body = "To All" & vbNewLine & _
"Please find attached FILE." & vbNewLine & _
"If you have any question, Please feel free to contact me" & vbNewLine & _
"Regards"
.Attachments.Add FileName
.Send
End With
Kill FileName
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub