I have the following VB code that works perfectly but I need to change the format it sends it from Pdf to an Excel sheet I have tried to change all the Pdf in the code to Xls . It does send the file as an excel sheet then but the recipients can’t open it as it says the file does not exist
Sub Send_Email()
Dim wPath As String, wFile As String
wPath = ThisWorkbook.Path
wFile = "Filepdf.Pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=wPath & wFile, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Set dam = CreateObject("Outlook.Application").CreateItem(0)
'
dam.To = Range("a2")
dam.Subject = Range("A1")
dam.Body = "Regards"
dam.Attachments.Add wPath & wFile
dam.Send
MsgBox "Email sent"
End Sub
Sub Send_Email()
Dim wPath As String, wFile As String
wPath = ThisWorkbook.Path
wFile = "Filepdf.Pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=wPath & wFile, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Set dam = CreateObject("Outlook.Application").CreateItem(0)
'
dam.To = Range("a2")
dam.Subject = Range("A1")
dam.Body = "Regards"
dam.Attachments.Add wPath & wFile
dam.Send
MsgBox "Email sent"
End Sub