Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
Junior Member
 
Posts: 11
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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...
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining PDFs RJ Excel Programming 0 December 31st 08 03:39 PM
Controling Acrobat PDFs YS Excel Discussion (Misc queries) 1 December 18th 04 10:47 AM
Controling Acrobat PDFs No Name Excel Programming 0 December 17th 04 04:41 PM
Creating PDFs from Excel VBA KarimK Excel Programming 0 October 5th 04 03:04 PM
Opening PDFs from VBA?? Eugene[_7_] Excel Programming 3 July 2nd 04 10:32 AM


All times are GMT +1. The time now is 09:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"