View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary L Brown Gary L Brown is offline
external usenet poster
 
Posts: 219
Default code for print dialogue

If MsgBox("Once you run this, you will clear the " & _
"information on the form." & vbCr & _
"Do you want to continue? " & vbCr & _
"You will have a chance to print first.", _
vbYesNo + vbExclamation, "Warning:") = vbNo Then
Exit Sub
End If

Application.Dialogs(xlDialogPrint).Show


HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"BorisS" wrote:

I am trying to get a print dialogue to appear as part of my code, not just to
print something. In other words, I have code that needs to run, and before
it does, I want to make sure the person has a chance to print. That said, if
they choose NOT to print, by selecting cancel, I need the code to continue
from there. Ideally I'd like the following sequence to occur upon initiation
of the macro:

1) quick informational dialogue that says "Warning: Once you run this, you
will clear the information on the form. Do you want to continue (you will
have a chance to first print)?"
2) if they select no, the whole code stops
3) if they select yes, a print dialogue comes up, giving them the normal
options they'd have under ctrl-p
4) if they select to print, it prints, and the code runs (basically takes
the data and puts it on a separate, holding sheet
5) if they select to cancel print, the code still runs and cleans the sheet
to the holding place

Right now, I have it successfully doing the transfer and clearing of data.
I need that initial piece of asking the questions, and giving the print
dialogue option.

Thanks for any help. My recording macro function will only show how to
print, not the dialogue option.
--
Boris