View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Printing to File using PrintOut

In some simple testing, if I removed the preview:=true, then everything worked
ok.

Just a guess, but it looks like if preview:=true, then excel figures that the
user may want to specify their own filename.

And it looks kind of weird that you'd be creating a binary file in Faxmaker
format.

When I use print to file, it's usually so I can use some old DOS command to send
the .prn file to the printer:

copy /b c:\temp.prn lpt1

I'm not sure Fax printers do the same thing????


Tim Baker wrote:

Having checked the output in print preview I'm trying to then print to file
but despite having given a PrToFileName it always produces a popup asking for
the file name. Other than this it works fine and does work if I give the
name at the prompt, it's just that I want to automated the file naming.
I'm using Excel 2000. Can someone please point out my mistake.
The PrintOut line is all on one line it's just split on this posting.

fname = "C:\temp.fax"
Sheets(Array("statistics", "graph")).PrintOut Preview:=True,
ActivePrinter:="Faxmaker on Ne00:", PrintToFile:=True, PrToFileName:=fname


--

Dave Peterson