ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing to File using PrintOut (https://www.excelbanter.com/excel-programming/319093-printing-file-using-printout.html)

Tim Baker

Printing to File using PrintOut
 
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[_5_]

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

Tim Baker

Printing to File using PrintOut
 
Thanks, didn't think of trying it without preview. I'm currently using it
just with the preview and wanted to add the output to file option. Seems
I'll have to approach it a different way.

Traditionally we have a report which used to be faxed out to several other
people. They have asked for an electronic version and the simplest option
was to send them a file which they could view using Imaging and the faxmaker
format enables this.


"Dave Peterson" wrote:

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


Dave Peterson[_5_]

Printing to File using PrintOut
 
Thanks for the explanation. I would never have thought of creating a .tif file
that way. (My FAX software uses .tif as a default.)

I'm not sure how big your document is, but you can take a picture of part of
your worksheet (select the range, shift-edit|copy) and even paste that into the
body of an html email.

If it's a small range, it might work for you.





Tim Baker wrote:

Thanks, didn't think of trying it without preview. I'm currently using it
just with the preview and wanted to add the output to file option. Seems
I'll have to approach it a different way.

Traditionally we have a report which used to be faxed out to several other
people. They have asked for an electronic version and the simplest option
was to send them a file which they could view using Imaging and the faxmaker
format enables this.

"Dave Peterson" wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 01:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com