• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to save word to PDF


New Member

I have a macro that runs and creates a word document. I want the macro to also create the word document to PDF and if possible extract the last 4 pages of the PDF as a separate file. Im new to macro so any help will be greatly appreciated.

I tried using

ActiveDocument.ExportAsFixedFormat Type:=xlTypePDF, Filename:=(Path & "\" & FirstName & "\" & LastName & " " & Date)
but doesnt work.
Last edited by a moderator:


Excel Ninja
What are values of Your Path, FirstName, LastName & Date?
If Your PathSeparator is \ ... then Your FileName would have PathSeparators,
which would mean that Your actual Filename would be LastName & " " & Date ...
Is there needed folders for that too?
... as well as ... Which format is Your Date?
... There are rules for Filename too.


New Member
Thanks for your response. Date format is ddmmyyyy for the files - the current macro setup creates a folder for each person and stores this word document there. PDF should also be in the same folder. You are correct - the file name is Lastname Firstname Docuementcreateddate Date.

The same macro that converted an excel worksheet to pdf had the command as below which is what I am just trying to modify to see if it works for word to pdf. I do not have macro experience so just trying by trial and error :(

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=(Path & "\" & FirstName & "\" & LastName & " " & Date)


Excel Ninja
If Your PathSeparator is \ ... then Your Filename would be LastName & " " & Date ...
... and I'm 99% sure that You do not have folder which name is Firstname!

... and then You cannot create PDF! ... because no folder!
>>> modify those "\" to "|" or almost any other marks!