Addobe PDF printer



I am executing the following prrocedure which is located in a standard module
to get Adobe PDF to generate a postscript file. When I call this procedure
from a worksheet module it executes perfectly. When I call it from a
userform module, it crashes with the error "When you create a postscript
file, you must rely on System fonts and use document fonts" and creates an
empty postscript file. It should be calling the same print driver in both
cases, but apparently is not. Does anyone know how to correct this? Am I
missing a qualifier?

Sub Printworkbookpdf()

Dim myprinter As String

ActiveSheet.PrintOut Preview:=False, ActivePrinter:="Adobe PDF",
PrintToFile:=True, PrToFileName:=psFileName

End Sub


If you are calling the posted sub in both cases, there should be no
difference in the result. The culprit would have to be in the set up prior
to calling the print sub.


The font setting is setup to use document fonts. Seems to me that I remember
from somewhere that the userform module is an application level module.
Would that affect the default location it searches for the printer? Perhaps
the network level rather than the local level for the userform call? If so,
I would have to tell it to only search the local printers.


After a great deal of experimentation, it turns out the problem has nothing
to do with being called from a userform. Apparently, once a BeforePrint
event procedure is called, and the Cancel is set to true, the Adobe PDF
printer will not work anymore until the Excel session is closed and Excel
reopened. Even if the BeforePrint event procedure is called again and the
Cancel is set to false, the Adobe PDF printer will not work. So Adobe PDF
printer will work up until the BeforePrint event procedure sets the Cancel to
true. I don't know if this is an Excel issue or an Adobe issue, and I have
not been able to find a work around. Hope this helps other Adobe PDF printer

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question