Dear VBA Expert,
I wanted to save outlook email into pdf once I select the email. ( please note: I have several subfolders in my inbox and wanted to work the marco to subfolder as well). I tried below but didn't work? Would you please advise where it is wrong ?
I also wanted to save attachment along with email body. Basically wanted two macros, one to save with attachment and other to save without. I tried below to save only email body but didn't work.
Sub SaveSelectedEmailsAsPDF()
Dim objSelection As Outlook.Selection
Dim objMail As Outlook.mailItem
Dim strPath As String
Dim objMsg As Object
' Set the folder path where you want to save the PDF
strPath = "C:\Approved Emails"
' Get the selected item(s) from Outlook
Set objSelection = Outlook.Application.ActiveExplorer.Selection
' Loop through each selected item
For Each objMail In objSelection
If objMail.Class = olMail Then
' Create a new MailItem object
Set objMsg = objMail.Copy
' Save the MailItem as a PDF file
objMsg.SaveAs strPath & objMail.Subject & ".pdf", olPDF
' Release the reference to the MailItem object
objMsg.Close olDiscard
End If
Next objMail
' Clean up objects
Set objSelection = Nothing
End Sub
Bookmarks