+ Reply to Thread
Results 1 to 4 of 4

Confirmation Box

  1. #1
    Registered User
    Join Date
    06-13-2012
    Location
    Leicester, England
    MS-Off Ver
    MS Office 365
    Posts
    61

    Confirmation Box

    Hi All

    I'm using a macro to send orders to suppliers. I have 20 suppliers I use and used a macro on all 20 of them. However the button on the sheet just sends the order but that's a little dangerous because if it's accidently pressed that's it.

    What I need is a confirmation box.

    I have created user forms for each supplier if I need them. The code below is what I am using. Where would I add this confirmation and do I need to make any codes in the userforms. Will I need to make the cancel button unload as well?

    Sub Send_Range_Or_Whole_Worksheet_with_MailEnvelope()
    Dim AWorksheet As Worksheet
    Dim Sendrng As Range
    Dim rng As Range

    On Error GoTo StopMacro

    With Application
    .ScreenUpdating = False
    .EnableEvents = False
    End With

    'Fill in the Worksheet/range you want to mail
    'Note: if you use one cell it will send the whole worksheet
    Set Sendrng = Worksheets("Supplier").Range("A1:I118")

    'Remember the activesheet
    Set AWorksheet = ActiveSheet

    'Create the mail and send it
    With Sendrng

    ' Select the worksheet with the range you want to send
    .Parent.Select

    'Remember the ActiveCell on that worksheet
    Set rng = ActiveCell

    'Select the range you want to mail
    .Select

    ' Create the mail and send it
    ActiveWorkbook.EnvelopeVisible = True
    With .Parent.MailEnvelope

    ' Set the optional introduction field thats adds
    ' some header text to the email body.
    .Introduction = Range("Q1").Value


    ' In the "With .Item" part you can add more options
    ' See the tips on this Outlook example page.
    ' http://www.rondebruin.nl/mail/tips2.htm
    With .Item
    .To = ""
    .Cc = ""
    .Subject = "New Order"
    .Send
    End With

    End With

    'select the original ActiveCell
    rng.Select
    End With

    'Activate the sheet that was active before you run the macro
    AWorksheet.Select

    StopMacro:
    With Application
    .ScreenUpdating = True
    .EnableEvents = True
    End With
    ActiveWorkbook.EnvelopeVisible = False

    End Sub

    Your help is very much apprieciated.

  2. #2
    Forum Contributor
    Join Date
    06-07-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    189

    Re: Confirmation Box

    Try like this

    Please Login or Register  to view this content.

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Confirmation Box

    I suspect you just want a
    Please Login or Register  to view this content.
    line near the top.
    Remember what the dormouse said
    Feed your head

  4. #4
    Registered User
    Join Date
    06-13-2012
    Location
    Leicester, England
    MS-Off Ver
    MS Office 365
    Posts
    61

    Re: Confirmation Box

    Thanks Guys

    They both worked!

    Cheers

+ 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