Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help printing to PDF file

I have a macro that currently creates 800+ custom 2-page
reports for different vendors off a large database. The
first two tabs in my workbook represent the first and
second page of each report. The macro goes through the
list of 800 vendors, grabs the data that pertains to them
(located on different tabs of the workbook), places it in
an area that produces the graphs and summary charts for
that vendor, prints that vendor's report, erases the data
in the form, and proceeds to the next vendor.

I have been asked to produce PDF files for each vendor
instead of paper copies. I thought this would be an easy
conversion, but when the printer is set to PDF, a new
dialog box opens when the following code executes:

'Print page 1
Sheets("Report 1").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True
'Print page 2
Sheets("Report 2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True

The dialog box is titled "Save PDF File As" and it
defaults to naming the PDF file with the first prefex as
the excel file. I can easily change that, except I can't
find any macro syntax that can either bypass this dialog
box by naming the file directly. I also can't figure out
how to write code that will accept the default file name
that is offered in this dialog box. I suspect that the
dialog box has been created by Adobe, but they can't help
me. This issue here is automation--I don't want someone
sitting at a computer pressing "yes" 800 times to accept
the default when I should be able to set a few parameters
within the subroutine and then walk away for four hours.

Any ideas?

I already approached Adobe thinking they would have
encountered this issue before, but they had no
suggestions.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help printing to PDF file

In Excel 2000 and later, the printout method has two related arguments

PrintToFile:= specify true
PrToFileName:= specify the file name

Have you tried using those arguments?

--
Regards,
Tom Ogilvy

"Karl Schmidt" wrote in message
...
I have a macro that currently creates 800+ custom 2-page
reports for different vendors off a large database. The
first two tabs in my workbook represent the first and
second page of each report. The macro goes through the
list of 800 vendors, grabs the data that pertains to them
(located on different tabs of the workbook), places it in
an area that produces the graphs and summary charts for
that vendor, prints that vendor's report, erases the data
in the form, and proceeds to the next vendor.

I have been asked to produce PDF files for each vendor
instead of paper copies. I thought this would be an easy
conversion, but when the printer is set to PDF, a new
dialog box opens when the following code executes:

'Print page 1
Sheets("Report 1").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True
'Print page 2
Sheets("Report 2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True

The dialog box is titled "Save PDF File As" and it
defaults to naming the PDF file with the first prefex as
the excel file. I can easily change that, except I can't
find any macro syntax that can either bypass this dialog
box by naming the file directly. I also can't figure out
how to write code that will accept the default file name
that is offered in this dialog box. I suspect that the
dialog box has been created by Adobe, but they can't help
me. This issue here is automation--I don't want someone
sitting at a computer pressing "yes" 800 times to accept
the default when I should be able to set a few parameters
within the subroutine and then walk away for four hours.

Any ideas?

I already approached Adobe thinking they would have
encountered this issue before, but they had no
suggestions.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Help printing to PDF file

Hi Tom,

Yes--I tried these first, but the problem is in the
conversion process. I can say
PrToFileName="vendor222.pdf" but the conversion doesn't
take place--the extension is pdf but the file type is
still xls when you open the new file. I can set up the
program to do that and create 800 excel files comprised
only of the two report pages and I can set up a string to
give each file a unique name matching its vendor, but
when I try to convert the stack of excel files to PDF
from inside Adobe I'm back in the same mess. When Adobe
starts the conversion process for a given file, it opens
Excel and you're eventually greated with the same "Save
PDF File As" dialog box with the default name written in
as "vendor222.pdf" and no way of pushing it through other
than clicking the "OK" button. It's the dialog box from
hell, because Excel produces it but doesn't seem to know
it exists when it comes to macro commands. Following the
MS naming conventions, I tried calling it "SavePDFFileAs"
in macro, but the VBA doesn't recognize it. Other ideas?

Karl
-----Original Message-----
In Excel 2000 and later, the printout method has two

related arguments

PrintToFile:= specify true
PrToFileName:= specify the file name

Have you tried using those arguments?

--
Regards,
Tom Ogilvy

"Karl Schmidt" wrote in

message
...
I have a macro that currently creates 800+ custom 2-

page
reports for different vendors off a large database. The
first two tabs in my workbook represent the first and
second page of each report. The macro goes through the
list of 800 vendors, grabs the data that pertains to

them
(located on different tabs of the workbook), places it

in
an area that produces the graphs and summary charts for
that vendor, prints that vendor's report, erases the

data
in the form, and proceeds to the next vendor.

I have been asked to produce PDF files for each vendor
instead of paper copies. I thought this would be an

easy
conversion, but when the printer is set to PDF, a new
dialog box opens when the following code executes:

'Print page 1
Sheets("Report 1").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True
'Print page 2
Sheets("Report 2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True

The dialog box is titled "Save PDF File As" and it
defaults to naming the PDF file with the first prefex

as
the excel file. I can easily change that, except I

can't
find any macro syntax that can either bypass this

dialog
box by naming the file directly. I also can't figure

out
how to write code that will accept the default file

name
that is offered in this dialog box. I suspect that the
dialog box has been created by Adobe, but they can't

help
me. This issue here is automation--I don't want

someone
sitting at a computer pressing "yes" 800 times to

accept
the default when I should be able to set a few

parameters
within the subroutine and then walk away for four

hours.

Any ideas?

I already approached Adobe thinking they would have
encountered this issue before, but they had no
suggestions.



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help printing to PDF file

If you are just printing to your normal printer and thinking putting PDF on
the end of the filename will work, that is not correct. You have to have
the PDFWriter printdriver set (from adobe acrobat not adobe acrobat reader
or an equivalent 3rd party driver).

--
Regards,
Tom Ogilvy



"Karl Schmidt" wrote in message
...
Hi Tom,

Yes--I tried these first, but the problem is in the
conversion process. I can say
PrToFileName="vendor222.pdf" but the conversion doesn't
take place--the extension is pdf but the file type is
still xls when you open the new file. I can set up the
program to do that and create 800 excel files comprised
only of the two report pages and I can set up a string to
give each file a unique name matching its vendor, but
when I try to convert the stack of excel files to PDF
from inside Adobe I'm back in the same mess. When Adobe
starts the conversion process for a given file, it opens
Excel and you're eventually greated with the same "Save
PDF File As" dialog box with the default name written in
as "vendor222.pdf" and no way of pushing it through other
than clicking the "OK" button. It's the dialog box from
hell, because Excel produces it but doesn't seem to know
it exists when it comes to macro commands. Following the
MS naming conventions, I tried calling it "SavePDFFileAs"
in macro, but the VBA doesn't recognize it. Other ideas?

Karl
-----Original Message-----
In Excel 2000 and later, the printout method has two

related arguments

PrintToFile:= specify true
PrToFileName:= specify the file name

Have you tried using those arguments?

--
Regards,
Tom Ogilvy

"Karl Schmidt" wrote in

message
...
I have a macro that currently creates 800+ custom 2-

page
reports for different vendors off a large database. The
first two tabs in my workbook represent the first and
second page of each report. The macro goes through the
list of 800 vendors, grabs the data that pertains to

them
(located on different tabs of the workbook), places it

in
an area that produces the graphs and summary charts for
that vendor, prints that vendor's report, erases the

data
in the form, and proceeds to the next vendor.

I have been asked to produce PDF files for each vendor
instead of paper copies. I thought this would be an

easy
conversion, but when the printer is set to PDF, a new
dialog box opens when the following code executes:

'Print page 1
Sheets("Report 1").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True
'Print page 2
Sheets("Report 2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1,
Collate:=True

The dialog box is titled "Save PDF File As" and it
defaults to naming the PDF file with the first prefex

as
the excel file. I can easily change that, except I

can't
find any macro syntax that can either bypass this

dialog
box by naming the file directly. I also can't figure

out
how to write code that will accept the default file

name
that is offered in this dialog box. I suspect that the
dialog box has been created by Adobe, but they can't

help
me. This issue here is automation--I don't want

someone
sitting at a computer pressing "yes" 800 times to

accept
the default when I should be able to set a few

parameters
within the subroutine and then walk away for four

hours.

Any ideas?

I already approached Adobe thinking they would have
encountered this issue before, but they had no
suggestions.



.



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
Printing to a PDF file daleatshel Excel Discussion (Misc queries) 1 August 13th 08 09:27 PM
Printing to PDF file... ShadowMind Excel Discussion (Misc queries) 0 August 29th 06 09:39 PM
printing to file Trevor New Users to Excel 2 August 23rd 06 10:01 AM
printing to pdf file dmexcel Excel Worksheet Functions 1 February 24th 06 03:43 AM
printing to a PDF file Tom S[_3_] Excel Programming 3 August 12th 03 09:34 PM


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

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"