View Single Post
  #2   Report Post  
Darcy
 
Posts: n/a
Default

Hi RG,

Did you ever solve this problem? I have a similar one. Using a macro I have
worksheets print to a specified location, but the created file is either
empty (0 KB) or I get an error message stating it's corrupted when I try to
open it with Adobe.
Some of the macro wording I used:

Application.ActivePrinter = "Adobe PDF on Ne00:"
For CoNo = 7 To 400
AppStr = "LoadCompany_" & CoNo
CellRefA = "A" & CoNo
CellRefB = "B" & CoNo
CoName = Range(CellRefB).Value
XStr = UCase(Range(CellRefA).Value)

If XStr = "X" Then
Application.Run AppStr
Sheets("SUMMARY").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True,
PrToFileName:="C:\Documents and Settings\marusichd\Desktop\Email Worksheets\"
& CoName & ".pdf"
Sheets("FLEET").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True,
PrToFileName:="C:\Documents and Settings\marusichd\Desktop\Email Worksheets\"
& CoName & "2.pdf"
Sheets("SELECT TO PRINT").Select

End If
Next CoNo

If you can toss anything my way it would be much appreciated.

Thanx,
Darcy :o)


"RG" wrote:

I need to generate a series of individual prints from a spreadsheet, going to
a PDF printer, and giving each one a different filename.
I have set the macro to do this, but it opens a PDFSaveAs window and waits
for a filename. Unfortunately the program is so fast and the PDF printer so
slow that they get out of seuqence and I dont know where I am in the sequence
of reports!
How do I pass the individual filenames to the print command in the macro?
Obviously I need a propoerty name to set, but I cannot guess it. I have tried
PrToFileName as the pop up box suggested that, but it doesn't work. Doesn't
even capitalise the property name when I type it.

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True,
prtofilename:="XYZ"


Where do I find all the property/variable names, please?

RG