Hi All,
I'm 99% there on what I need to do, just need a little help with the last bit please!
Each month we create a performance report for our suppliers, titled "REPORT NAME - MONTH - SUPPLIER NAME" which is saved as .pdf and emailed out to them directly.
Using the script below I can create one report in .pdf and create the email, but I need it to repeat for about 29 more suppliers.
When I run it VBA gives me an error message which I follow and it keeps telling me it either needs "End With" or "End Sub". I type the command it's asking for but it keeps asking and doesn't stop asking for it.
Any ideas what's going on please?
Taken from this website: Automate Excel to PDF and Email PDF Document using VBA | Excel VBA Training Videos
Sub sendReminderMail()
ChDir “C:\Users\takyar\Desktop”
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
“C:\Users\takyar\Desktop\test-save.pdf”, OpenAfterPublish:=True
Dim OutLookApp As Object
Dim OutLookMailItem As Object
Dim myAttachments As Object
Set OutLookApp = CreateObject(“Outlook.application”)
Set OutLookMailItem = OutLookApp.CreateItem(0)
Set myAttachments = OutLookMailItem.Attachments
With OutLookMailItem
.To = “takyar@hotmail.com”
.Subject = “Data”
.Body = “The Excel data is attached in PDF format.”
myAttachments.Add “C:\Users\takyar\Desktop\test-save.pdf”
‘.send
.Display
End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing
End Sub
I'm 99% there on what I need to do, just need a little help with the last bit please!
Each month we create a performance report for our suppliers, titled "REPORT NAME - MONTH - SUPPLIER NAME" which is saved as .pdf and emailed out to them directly.
Using the script below I can create one report in .pdf and create the email, but I need it to repeat for about 29 more suppliers.
When I run it VBA gives me an error message which I follow and it keeps telling me it either needs "End With" or "End Sub". I type the command it's asking for but it keeps asking and doesn't stop asking for it.
Any ideas what's going on please?
Taken from this website: Automate Excel to PDF and Email PDF Document using VBA | Excel VBA Training Videos
Sub sendReminderMail()
ChDir “C:\Users\takyar\Desktop”
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
“C:\Users\takyar\Desktop\test-save.pdf”, OpenAfterPublish:=True
Dim OutLookApp As Object
Dim OutLookMailItem As Object
Dim myAttachments As Object
Set OutLookApp = CreateObject(“Outlook.application”)
Set OutLookMailItem = OutLookApp.CreateItem(0)
Set myAttachments = OutLookMailItem.Attachments
With OutLookMailItem
.To = “takyar@hotmail.com”
.Subject = “Data”
.Body = “The Excel data is attached in PDF format.”
myAttachments.Add “C:\Users\takyar\Desktop\test-save.pdf”
‘.send
.Display
End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing
End Sub