Hello I am new of VBA.
I can generate the pdf with new name every time, however i am not able to attached latest generated file in email. it is giving me me error
" Path does not exist, verify the path in correct."
here is the code. please help me expert
Sub sendReminderMail()
ChDir "C:\Users\Vinod\Desktop\Latest Billing"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
ActiveSheet.Range("Q10").Value, OpenAfterPublish:=True
filelocation = "C:\Users\Vinod\Desktop\Latest Billing"
Dim OutLookApp As Object
Dim OutLookMailItem As Object
Dim myAttachments As Object
Dim maildest As String
Set OutLookApp = CreateObject("Outlook.application")
Set OutLookMailItem = OutLookApp.CreateItem(0)
Set myAttachments = OutLookMailItem.Attachments
maildest = ActiveSheet.Range("b18").Value
With OutLookMailItem
.To = maildest
.Subject = "Data"
.Body = "Thank you for contacting us. Your estimate can be viewed,_ printed and downloaded as PDF from the link below."
.Attachments.Add Sheets("Invoice").Range("Q10").Value & "" & ".pdf"
'.send
.Display
End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing
End Sub
I can generate the pdf with new name every time, however i am not able to attached latest generated file in email. it is giving me me error
" Path does not exist, verify the path in correct."
here is the code. please help me expert
Sub sendReminderMail()
ChDir "C:\Users\Vinod\Desktop\Latest Billing"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
ActiveSheet.Range("Q10").Value, OpenAfterPublish:=True
filelocation = "C:\Users\Vinod\Desktop\Latest Billing"
Dim OutLookApp As Object
Dim OutLookMailItem As Object
Dim myAttachments As Object
Dim maildest As String
Set OutLookApp = CreateObject("Outlook.application")
Set OutLookMailItem = OutLookApp.CreateItem(0)
Set myAttachments = OutLookMailItem.Attachments
maildest = ActiveSheet.Range("b18").Value
With OutLookMailItem
.To = maildest
.Subject = "Data"
.Body = "Thank you for contacting us. Your estimate can be viewed,_ printed and downloaded as PDF from the link below."
.Attachments.Add Sheets("Invoice").Range("Q10").Value & "" & ".pdf"
'.send
.Display
End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing
End Sub