Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Decline Save

Hi,

I have a PrintToFile statement telling Excel to save a worksheets as Tiff
document. When the procedure is triggered a pop-up box appears in order to
let the user define filename. This works fine. But when the user doens't
wan't to save a copy and simply presses 'cancel' he/she gets a runtime error
1004 Method PrintOut of object Worksheet failed. How do I programme the
procedure in order to not show the error.

Sheet1.PrintOut ActivePrinter:="Microsoft Office Document Image Writer", _
PrintToFile:=True, _
PrToFileName:="\\Nlmtr-wifs001\CSBUSSE\Data
Services\SSV\Netwerkklachten\Overige Info\weekoverzichtenbrieven\Status
Workload SSV " & _
DatePart("yyyy", ThisMonday - 1) & " week " &
DatePart("ww", ThisMonday - 1, vbMonday, vbUseSystem) & ".mdi"

Gr.

Basta
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Decline Save


Use some error handling something like:

Code:
--------------------

On Error Goto Nxt
Sheet1.PrintOut ActivePrinter:="Microsoft Office Document Image Writer", _
PrintToFile:=True, _
PrToFileName:="\\Nlmtr-wifs001\CSBUSSE\Data
Services\SSV\Netwerkklachten\Overige Info\weekoverzichtenbrieven\Status
Workload SSV " & _
DatePart("yyyy", ThisMonday - 1) & " week " &
DatePart("ww", ThisMonday - 1, vbMonday, vbUseSystem) & ".mdi"
Nxt:
'rest of your code

--------------------

Basta1980;367553 Wrote:
Hi,

I have a PrintToFile statement telling Excel to save a worksheets as
Tiff
document. When the procedure is triggered a pop-up box appears in order
to
let the user define filename. This works fine. But when the user
doens't
wan't to save a copy and simply presses 'cancel' he/she gets a runtime
error
1004 Method PrintOut of object Worksheet failed. How do I programme the
procedure in order to not show the error.


Code:
--------------------

Sheet1.PrintOut ActivePrinter:="Microsoft Office Document Image Writer", _
PrintToFile:=True, _
PrToFileName:="\\Nlmtr-wifs001\CSBUSSE\Data
Services\SSV\Netwerkklachten\Overige Info\weekoverzichtenbrieven\Status
Workload SSV " & _
DatePart("yyyy", ThisMonday - 1) & " week " &
DatePart("ww", ThisMonday - 1, vbMonday, vbUseSystem) & ".mdi"

--------------------

Gr.

Basta



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=102966

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Decline Save

Hi Basta,

Put the following statement before the first line of code:

On Error Resume Next

This should help

"Basta1980" wrote in message
...
Hi,

I have a PrintToFile statement telling Excel to save a worksheets as Tiff
document. When the procedure is triggered a pop-up box appears in order to
let the user define filename. This works fine. But when the user doens't
wan't to save a copy and simply presses 'cancel' he/she gets a runtime
error
1004 Method PrintOut of object Worksheet failed. How do I programme the
procedure in order to not show the error.

Sheet1.PrintOut ActivePrinter:="Microsoft Office Document Image Writer", _
PrintToFile:=True, _
PrToFileName:="\\Nlmtr-wifs001\CSBUSSE\Data
Services\SSV\Netwerkklachten\Overige Info\weekoverzichtenbrieven\Status
Workload SSV " & _
DatePart("yyyy", ThisMonday - 1) & " week " &
DatePart("ww", ThisMonday - 1, vbMonday, vbUseSystem) & ".mdi"

Gr.

Basta


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Decline Save


On error resume next is a bad idea, it bypasses all errors.Howard31;367589 Wrote:
Hi Basta,

Put the following statement before the first line of code:

On Error Resume Next

This should help

"Basta1980" wrote in message
...
Hi,

I have a PrintToFile statement telling Excel to save a worksheets as

Tiff
document. When the procedure is triggered a pop-up box appears in

order to
let the user define filename. This works fine. But when the user

doens't
wan't to save a copy and simply presses 'cancel' he/she gets a

runtime
error
1004 Method PrintOut of object Worksheet failed. How do I programme

the
procedure in order to not show the error.

Sheet1.PrintOut ActivePrinter:="Microsoft Office Document Image

Writer", _
PrintToFile:=True, _
PrToFileName:="\\Nlmtr-wifs001\CSBUSSE\Data
Services\SSV\Netwerkklachten\Overige

Info\weekoverzichtenbrieven\Status
Workload SSV " & _
DatePart("yyyy", ThisMonday - 1) & " week " &
DatePart("ww", ThisMonday - 1, vbMonday, vbUseSystem) & ".mdi"

Gr.

Basta



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=102966

  #5   Report Post  
Posted to microsoft.public.excel.programming
r r is offline
external usenet poster
 
Posts: 125
Default Decline Save

"Simon Lloyd" wrote:


On error resume next is a bad idea, it bypasses all errors.


??

On Error Resume Next
'....
On Error GoTo 0

it would be nice to see the code more ...
the error handling may be unnecessary

regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html

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
Save, save as, page setup dimmed out in unprotected excel sheet? ccKeithJ Excel Discussion (Misc queries) 3 December 14th 07 07:07 PM
SAVE and SAVE AS options disappeared from the drop down FILE menu [email protected] Excel Discussion (Misc queries) 2 July 12th 07 09:14 AM
Disable save, save as, but allow save via command button TimN Excel Programming 10 September 1st 06 07:05 PM
How to diasble save and save as menu but allow a save button hon123456 Excel Programming 1 June 12th 06 09:50 AM
Totally Disabling (^ save ) (Save as) and Save Icon – Which code do I use: harpscardiff[_10_] Excel Programming 8 November 10th 05 12:24 PM


All times are GMT +1. The time now is 02:35 AM.

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

About Us

"It's about Microsoft Excel"