PC Review


Reply
Thread Tools Rate Thread

Decline Save

 
 
Basta1980
Guest
Posts: n/a
 
      3rd Jun 2009
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
 
Reply With Quote
 
 
 
 
Howard31
Guest
Posts: n/a
 
      3rd Jun 2009
Hi Basta,

Put the following statement before the first line of code:

On Error Resume Next

This should help

"Basta1980" <(E-Mail Removed)> wrote in message
news:FCE1115E-228D-4718-9BB8-(E-Mail Removed)...
> 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


 
Reply With Quote
 
r
Guest
Posts: n/a
 
      3rd Jun 2009
"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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Decline on Behalf of another Peter J. Schwartz Microsoft Outlook Calendar 0 8th Jan 2010 07:15 PM
tentatively decline? =?Utf-8?B?UGF0Q1I=?= Microsoft Outlook Calendar 2 11th Nov 2006 05:12 AM
Is the NHS in decline? murdoch General Discussion 4 30th Sep 2006 08:44 PM
New! Decline SP2 W/ AU Treeman Windows XP General 4 2nd May 2005 04:31 PM
New! Decline SP2 W/ AU Treeman Windows XP General 0 29th Apr 2005 01:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:36 PM.