jcbaggett16
New Member
- Joined
- Feb 14, 2024
- Messages
- 9
- Office Version
- 365
- Platform
- Windows
All,
I am trying to save a file to PDF then pull that file and attach to email. I can get it to save to a file path but I can not get it to pull from the file path.
Sub PDF()
ChDir "C:\Users\...\Desktop\New folder"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\...\Desktop\New folder\Transition " & Range("L2").Text
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 = ""
.Subject = ""
.Body = ""
myAttachments.Add "C:\Users\...\Desktop\New folder\Test.PDF"
'.send
.Display
End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing
End Sub
I am trying to save a file to PDF then pull that file and attach to email. I can get it to save to a file path but I can not get it to pull from the file path.
Sub PDF()
ChDir "C:\Users\...\Desktop\New folder"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\...\Desktop\New folder\Transition " & Range("L2").Text
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 = ""
.Subject = ""
.Body = ""
myAttachments.Add "C:\Users\...\Desktop\New folder\Test.PDF"
'.send
.Display
End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing
End Sub
Last edited by a moderator: