+ Reply to Thread
Results 1 to 3 of 3

code for print dialogue

  1. #1
    BorisS
    Guest

    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. #2
    Gary L Brown
    Guest

    RE: 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
    gary_brown@ge_NOSPAM.com
    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. #3
    BorisS
    Guest

    RE: 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
    > gary_brown@ge_NOSPAM.com
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1