Hi, i have this piece of code for printing email to pdf from a specific folder in outlook, but the recipients names are missing at the top of the page. Anyone knows whats wrong?
![]()
Please Login or Register to view this content.
Hi, i have this piece of code for printing email to pdf from a specific folder in outlook, but the recipients names are missing at the top of the page. Anyone knows whats wrong?
![]()
Please Login or Register to view this content.
Can anyone help please?
Try saving the email as a mht file then opening with Word and exporting.
![]()
Please Login or Register to view this content.
Last edited by ByteMarks; 09-07-2023 at 04:39 AM.
Hi ByteMarks, i tried your code but nothing seems to be happening. The only thing i changed was the folder name from Pre Alert responses to my folder name. Could you please advise?
Have you tried stepping through? It should create an .mht file in temporary folder, open it with Word and then saving that as a pdf to whatever folderPath is.
I set the folderpath to my desktop and i changed the code to have the .mht file save on my desktop as well. I can see the .mht file being created, but no pdf. I changed the word visible part to true, but it did not open the word app. i think this is where something went wrong?
Try adding the line in red and see if Word opens.
![]()
Please Login or Register to view this content.
Word opened with that line added, but still no pdf
Maybe it's Word 2003 that can't convert to pdf? If you can't manually save as a pdf, then that would seem to be the case.
I'm using microsoft 365. is there any other way?
I don't know of another way, although there may be one.
Does Word open the mht file after this line?
If you stop the code after the line above leaving the document open, can you manually save as a pdf?![]()
Please Login or Register to view this content.
Is folderPath & Filename & ".pdf" a valid file path?
when i tried to save as pdf manually, this message appears. Is this the cause of the pdf not appearing? if so, how do i solve it?
Maybe the mht isn't supported. Can you save it in docx format?
it allows me to save as docx, and i need to apply a sensitivity label just before it saves. Can this be done in the macro?
It seems it should be a property you can set, but sensitivity labels are disabled for me so I'm unable to test.
Once the docx is saved manually with the label, can you convert it to pdf?
I suspect you need a business or school account, rather than a personal account.
https://learn.microsoft.com/en-us/pu...itivity-labels
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
yes, i can save as pdf after i apply the label and save as a word docx. How about i use a word template that has the label applied first? how do i write the code to open that word template, populate the email information in it, and save as pdf?
I got it working after many tries. Thanks ByteMarks for your help. heres the code
![]()
Please Login or Register to view this content.
Great idea! Thanks for sharing.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks