ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   issues with getting .pdfs to be created (https://www.excelbanter.com/excel-programming/443841-issues-getting-pdfs-created.html)

c1802362[_2_]

issues with getting .pdfs to be created
 
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

mscir

issues with getting .pdfs to be created
 
On 11/2/2010 3:51 PM, c1802362 wrote:
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/devs...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

c1802362[_2_]

issues with getting .pdfs to be created
 
On Nov 2, 7:03*pm, mscir wrote:
On 11/2/2010 3:51 PM, c1802362 wrote:





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/devs...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...

c1802362[_2_]

issues with getting .pdfs to be created
 
On Nov 2, 7:03*pm, mscir wrote:
On 11/2/2010 3:51 PM,c1802362wrote:





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/devs...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


All times are GMT +1. The time now is 03:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com