View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
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