Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default code for print dialogue

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default code for print dialogue

Perfect. Many thanks.
--
Boris


"Gary L Brown" wrote:

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

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
what is print to file in print dialogue box and its useage? Vandana Excel Worksheet Functions 0 August 23rd 06 11:45 AM
Suppressing print dialogue box sgrech Excel Discussion (Misc queries) 0 September 24th 05 12:14 PM
Closing the Print Dialogue box [email protected] Excel Programming 2 July 7th 05 09:56 PM
Need VBA code for "Open Dialogue" box Brent E Excel Discussion (Misc queries) 2 February 8th 05 04:23 AM
how can I add a print dialogue? Rob Excel Programming 2 February 5th 05 10:11 PM


All times are GMT +1. The time now is 05:51 PM.

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"