I don't think you can stop the dialog being displayed, but you can take
action if someone decides to click on it. Put the following in the first
line of your macro:
On Error GoTo xxxx
where xxxx should be a part of the macro which returns to worksheet to its
original state. Presumably you already have a portion of code which re-hides
the row after successful printing so you could point the On Error code at
that.
As an example:
Sub MyPrintingMacro()
On Error GoTo hiderowsagain
'code here that unhides the rows
'code here that does the printing
hiderowsagain:
'code here that hides the rows when finished
End Sub
Now, either the macro will run in full (unhide then print then hide) or, if
the user cancels, the interrupt handler should tell it to jump straight to
the row hiding code anyway.
If the macro really is that simple, you might get away with using On Error
Resume Next instead.
Bear in mind, ALL trapped errors will cause it to jump, not just the
cancelling of a print job. I don't think you can look out specifically for a
cancelled print.
Of course, you still end up with a half-finished print job, but I expect
that would be better than removing the cancel function altogether in case a
print job gets invoked by mistake.
Please let me know if this works.
Paul C,

Signature
> Please could anyone tell me if there is a way of stopping
> the Cancel Print Dialog Box from being displayed within a
[quoted text clipped - 8 lines]
>
> Many thanks in advance, Annie
Paul Cundle - 21 Aug 2003 18:29 GMT
It doesn't work, does it? I thought error handlers could pick up this but it
can't, sorry.
Anyone else?
Paul C,

Signature
I wrote:
> I don't think you can stop the dialog being displayed, but you can
> take action if someone decides to click on it. Put the following in
[quoted text clipped - 46 lines]
>>
>> Many thanks in advance, Annie
Annie - 23 Aug 2003 17:49 GMT
Many thanks for trying to help anyway.
Annie
>-----Original Message-----
>It doesn't work, does it? I thought error handlers could pick up this but it
[quoted text clipped - 55 lines]
>
>.
Paul Cundle - 23 Aug 2003 20:10 GMT
Have you tried asking on news:microsoft.public.excel.programming ?
It's a busy group, but there are several MVP's there and if anyone can
answer your question then one of them probably can.
Paul C,

Signature
> Many thanks for trying to help anyway.
>
[quoted text clipped - 62 lines]
>>
>> .