Printing to PDF file from excel - some problem with fonts - I think

When I print to PDF by hand it works fine, but when I print from a macro the size becomes 10 times bigger, and is not recognized as a pdf file.

I have deactivated rely on system fonts.. in the ADOBE pdf-printer

The code I use is:
PrintFileName = "xxx2.pdf"
hj = ActiveSheet.PrintOut(1, 1, 1, False, "Adobe PDF på Ne04:", True, False, PrintFileName)

If I try opening the file in Adobe Illustrator I get the message:

Font not found on the system. Missing font has been substituted
Then the file is opened, but the text is nonsense

I attach the file if it is of any help. Test3 is the file written 'by hand', xxx2 is the file written by the macro

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

exciter_grConnect With a Mentor Commented:
I am not an expert on pdf creation, but i think that you should not set your printer to print to a file. When you do, even if you give a known extension like pdf, or doc, the file that is created is not in that format. It is written in printer 'language' and even so it does have the correct extension, it can not be opened in applications like acrobat or word.

When you do the procedure 'by hand' do you click on the 'print-to-file' option in the printing dialog box, or you just select the Adobe pdf-printer? Try checking this option when you printing by hand i think you will get the same results as the macro output.

If you use excel 2007 version, it has an built-in tool to create pdfs through macros with a code like the following:

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\MyWorks\ee_sample97.pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= True

Hope this helps
SimonOrtmannAuthor Commented:
Thank you - it finaly solved the problem. What I didnot know was hat I have to download an add-in before it worked
All Courses

From novice to tech pro — start learning today.