View Single Post
  #3   Report Post  
RG
 
Posts: n/a
Default

Darcy
Glad to know I'm not the only one!
Similar problems, either a zero file size or corrupted file.
The difference is that I'm using PDF995 as the printer. Freeware and no
support.
As I see it, the problem is that the file name is set outside of the Excel
program - in a dialog box opened by the printer driver.
The way I got around it was by creating a message box in the Excel macro
telling me which file I was up to, then I input the required filename into
the PDF box when it prompts. Not an ideal solution, but it does solve the
problem until I can find another.
I am guessing, but I think you need to pass the required filename to a
different program. The question is, knowing the program name and the variable
name it's setting.
I'm not sure PrintToFile is relevent because printing to a PDF printer has
to go to file.
If this helps you develop further, let me know!!!
RG
:-(


"Darcy" wrote:

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