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

test3.pdf
xxx2.pdf
SimonOrtmannAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

exciter_grCommented:
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
Best
exciter
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Acrobat

From novice to tech pro — start learning today.