issues with getting .pdfs to be created


C

c1802362

I've tried a number of ways to get my VBA code to create and save pdf
files from excel. I've used a number of different code scraps from
this group and others, and the only thing that works on my system
(Excel 2003 running on Windows XP) is the following - with caveats:

The issue is that when I launch the code, it won't run if the Adobe
setup box "Rely on system fonts only" is checked. If I uncheck the box
manually, the code works fine. The issue is that for my users to
manually go into the Print menu and change the preferences each time
they run the code the first time is impractical. Once the box has been
unchecked, there's no issue as long as the application stays open.

Interestingly, using the normal method of creating a pdf from Excel
(launching from the toolbar button in Excel) the checked box is the
default setting and everything runs fine.

So,....any suggestions?

Art

code follows:

Sub Print_PDF()

'need to check Reference to Acrobat Distiller in Tools -->
References
' ensure "Rely on system fonts only..." box is unchecked on page
setup
'Define the postscript and .pdf file names.

Dim PSFileName As String
Dim PDFFileName As String
Dim lclFileName As String

lclFileName = Cells(1, 1) ' filename is contained in first
cell

PSFileName = "D:\My Documents\" & lclFileName & ".ps"
PDFFileName = "D:\My Documents\" & lclFileName & ".pdf"
'Print the Excel range to the postscript file

'was originally ActivePrinter = "Adobe PDF"

ActiveWindow.SelectedSheets.PrintOut copies:=1, preview:=False,
ActivePrinter:="Adobe PDF on Ne01:", _
printtofile:=True, collate:=True, prtofilename:=PSFileName


'Convert the postscript file to .pdf
Dim myPDF As PdfDistiller
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ""

Kill "D:\My Documents\" & lclFileName & ".ps"
Kill "D:\My Documents\" & lclFileName & ".log"

End Sub
 
Ad

Advertisements

M

mscir

I've tried a number of ways to get my VBA code to create and save pdf
files from excel. I've used a number of different code scraps from
this group and others, and the only thing that works on my system
(Excel 2003 running on Windows XP) is the following - with caveats:

The issue is that when I launch the code, it won't run if the Adobe
setup box "Rely on system fonts only" is checked. If I uncheck the box
manually, the code works fine. The issue is that for my users to
manually go into the Print menu and change the preferences each time
they run the code the first time is impractical. Once the box has been
unchecked, there's no issue as long as the application stays open.

Interestingly, using the normal method of creating a pdf from Excel
(launching from the toolbar button in Excel) the checked box is the
default setting and everything runs fine.

So,....any suggestions?

Art

code follows:

Sub Print_PDF()

'need to check Reference to Acrobat Distiller in Tools -->
References
' ensure "Rely on system fonts only..." box is unchecked on page
setup
'Define the postscript and .pdf file names.

Dim PSFileName As String
Dim PDFFileName As String
Dim lclFileName As String

lclFileName = Cells(1, 1) ' filename is contained in first
cell

PSFileName = "D:\My Documents\"& lclFileName& ".ps"
PDFFileName = "D:\My Documents\"& lclFileName& ".pdf"
'Print the Excel range to the postscript file

'was originally ActivePrinter = "Adobe PDF"

ActiveWindow.SelectedSheets.PrintOut copies:=1, preview:=False,
ActivePrinter:="Adobe PDF on Ne01:", _
printtofile:=True, collate:=True, prtofilename:=PSFileName


'Convert the postscript file to .pdf
Dim myPDF As PdfDistiller
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ""

Kill "D:\My Documents\"& lclFileName& ".ps"
Kill "D:\My Documents\"& lclFileName& ".log"

End Sub

Will this work for you?

http://forums.adobe.com/thread/422928

It was very hard to find, but look at this document:

http://support.adobe.com/devsup/devsup.nsf/docs/53549.htm

So in order to change the "Rely on system fonts only; do not use
documents fonts" I had to change this key:

HKEY_CURRENT_USER\Printers\DevModePerUser\Adobe PDF

Now, it is a binary key and it should be different for each version of
Acrobat.

In Acrobat 9.0 Professional I had to change only one byte in the binary
data, and it was located at the index 0x0472.

0 Value = Off / Disabled
1 Value = On / Enabled

A small mistake: the index number is: 0x046C (1132)

Cheers,

Doron Ori Tal

Hope that helps.
Cheers,
Doron Ori Tal
 
C

c1802362

Will this work for you?

http://forums.adobe.com/thread/422928

It was very hard to find, but look at this document:

http://support.adobe.com/devsup/devsup.nsf/docs/53549.htm

So in order to change the "Rely on system fonts only; do not use
documents fonts" I had to change this key:

HKEY_CURRENT_USER\Printers\DevModePerUser\Adobe PDF

Now, it is a binary key and it should be different for each version of
Acrobat.

In Acrobat 9.0 Professional I had to change only one byte in the binary
data, and it was located at the index 0x0472.

0 Value = Off / Disabled
1 Value = On / Enabled

A small mistake: the index number is: 0x046C (1132)

Cheers,

Doron Ori Tal

Hope that helps.
Cheers,
Doron Ori Tal

I'll give it a try tomorrow at work...
 
Ad

Advertisements

C

c1802362

Will this work for you?

http://forums.adobe.com/thread/422928

It was very hard to find, but look at this document:

http://support.adobe.com/devsup/devsup.nsf/docs/53549.htm

So in order to change the "Rely on system fonts only; do not use
documents fonts" I had to change this key:

HKEY_CURRENT_USER\Printers\DevModePerUser\Adobe PDF

Now, it is a binary key and it should be different for each version of
Acrobat.

In Acrobat 9.0 Professional I had to change only one byte in the binary
data, and it was located at the index 0x0472.

0 Value = Off / Disabled
1 Value = On / Enabled

A small mistake: the index number is: 0x046C (1132)

Cheers,

Doron Ori Tal

Hope that helps.
Cheers,
Doron Ori Tal

Doron,

thanks for the help, but I'm running headlong into the system
administrator who won't let me in to change the profile as you
suggest.

So, unless there's a way to access an add-in, I guess I'm out of luck

Art
 

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

Top