hi everyone, I am trying to save a PDF files via email using VBA. I am running my code but gets an error when I am trying to attach my files to the email. Could someone help me with this?
My guess is that I dont define my variant fichier as it should be and I've tried to define it otherwise and it didnt worked.
Thank you all
My guess is that I dont define my variant fichier as it should be and I've tried to define it otherwise and it didnt worked.
Thank you all
Code:
Dim xOutlookObj, xEmailObj As Object
Dim fichier As String
fichier = "C:\my link.pdf"
Set xOutlookObj = CreateObject("Outlook.Application")
Set xEmailObj = xOutlookObj.CreateItem(0)
With xEmailObj
.Display
.To = "someone@hotmail.com"
.CC = ""
.Subject = "my subject"
.Attachement.Add fichier ' This is the line where my error comes. Everything before or after works fine.
.Body = " Hello here is your mail"
.Send
End With