Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Problem with the PrToFileName parameter when using the Printout method on a worksheet

Hi,

I have the following line of code in my module:
ActiveWindow.SelectedSheets.PrintOut To:=intPageTo ,
PrintToFile:=True, PrToFilename:="Statement For " & Master.UniqueID &
" " & Date

When I am running the code the application hangs.

So I have changed the above to the following:
ActiveWindow.SelectedSheets.PrintOut To:=intPageTo

So now the sheets are printed properly but I can't save the sheet.
Basically I ewant to save this sheet (to another sheet or any file
format) for future reference.

Can someone help me.

Thanks in advance

regards,
Prasad Vanka
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Problem with the PrToFileName parameter when using the Printout method on a worksheet

Prasad,

You may be getting an invalid filename due to the Date containing bad
characters in its default conversion to string. Try changing

PrToFilename:="Statement For " & Master.UniqueID & " " & Date
to

PrToFilename:="Statement For " & Master.UniqueID & " " &
Format(Date,"yyyymmdd")

HTH,
Bernie
MS Excel MVP

"Prasad Vanka" wrote in message
om...
Hi,

I have the following line of code in my module:
ActiveWindow.SelectedSheets.PrintOut To:=intPageTo ,
PrintToFile:=True, PrToFilename:="Statement For " & Master.UniqueID &
" " & Date

When I am running the code the application hangs.

So I have changed the above to the following:
ActiveWindow.SelectedSheets.PrintOut To:=intPageTo

So now the sheets are printed properly but I can't save the sheet.
Basically I ewant to save this sheet (to another sheet or any file
format) for future reference.

Can someone help me.

Thanks in advance

regards,
Prasad Vanka



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Problem with the PrToFileName parameter when using the Printout method on a worksheet

Hi,

Thanks for the answer. I have got one more query. It did save the sheet
but I don't know what type of file was created. When I try to open it I
get an error message, for eg.,

Windows cannot open this file:
File: Statement For UniqueID-70055#Date-20040513

Is there anyway I can specify the file type. If so what types of files I
can save it to?

Thanks in advance.

regards,
Prasad Vanka

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Problem with the PrToFileName parameter when using the Printout method on a worksheet

Prasad,

Try adding the file extension to the print to file name:

PrToFilename:="Statement For " & Master.UniqueID & " " &
Format(Date,"yyyymmdd") & ".prn"

You could also try ".txt" instead of ".prn"

HTH,
Bernie
MS Excel MVP

"Venkateswara Prasad Vanka" wrote in
message ...
Hi,

Thanks for the answer. I have got one more query. It did save the sheet
but I don't know what type of file was created. When I try to open it I
get an error message, for eg.,

Windows cannot open this file:
File: Statement For UniqueID-70055#Date-20040513

Is there anyway I can specify the file type. If so what types of files I
can save it to?

Thanks in advance.

regards,
Prasad Vanka

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Problem with the PrToFileName parameter when using the Printout method on a worksheet

Hi,

sorry that's not working. When I am specifying .prn it is saving as
.pr0. I don't know why n is being converted as 0(zero). I don't want the
save as text option as there are some logos on the sheet which cant be
changed. What might be the best option.

Thanks in advance
regards,
Prasad Vanka

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Problem with the PrToFileName parameter when using the Printout method on a worksheet

Prasad,

The default is a .prn, so I don't know why it is not taking it. Try running
the macro without the PrToFilename , and Excel will open a dialog to have
you enter or choose the file name. Then see how the file turns out.

HTH,
Bernie
MS Excel MVP

"Venkateswara Prasad Vanka" wrote in
message ...
Hi,

sorry that's not working. When I am specifying .prn it is saving as
pr0. I don't know why n is being converted as 0(zero). I don't want the
save as text option as there are some logos on the sheet which cant be
changed. What might be the best option.

Thanks in advance
regards,
Prasad Vanka

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with the PrToFileName parameter when using the Printout method on a worksheet

Venkateswara Prasad Vanka wrote in message ...
Hi,

Thanks for the answer. I have got one more query. It did save the sheet
but I don't know what type of file was created. When I try to open it I
get an error message, for eg.,

Windows cannot open this file:
File: Statement For UniqueID-70055#Date-20040513

Is there anyway I can specify the file type. If so what types of files I
can save it to?

Thanks in advance.

regards,
Prasad Vanka


You might want to look at this article for a bit more info on prn file formats.

http://www.frogmorecs.com/arts/what_is_a_prn_file.html

Regards

Tony Edgecombe
www.frogmorecs.com
Software for printing
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
Printout Code Problem Jonsson[_15_] Excel Programming 8 April 26th 04 03:21 PM
ActiveSheet.PrintOut - problem Derek T. Excel Programming 3 February 23rd 04 07:36 PM
Pass string as Parameter in OpenText method No Name Excel Programming 0 January 8th 04 06:22 AM
Excel vba printout method Curtis[_4_] Excel Programming 11 October 28th 03 01:15 PM


All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"