Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    May 2009
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am working on a template with a dialog box running from Auto New. If none of 8 check boxes were selected and the user clicked OK button, I want a message box to display to inform user a selection is required. The code works up to this point. When the OK button is clicked on the message box, the dialog box closes and the document displays with blank fields. I want the dialog box to stay active under a selection is made or user clicks Cancel button.

    How do I keep the dialog box open so the user can select at least one of the check boxes. I have a call to CheckProduct macro at the top of the Sub for the OK button. Sounds like I need the code for the OK button to exit if none of the check boxes are selected but keep the form open so user can make a selection.

    Thanks,
    Charlie charlie6067

    Sub CheckProduct()
    ' Validates at least one product check box is selected.

    If VolDental.Value = False And _
    VolLife.Value = False And _
    VolLTD.Value = False And _
    VolSTD.Value = False Then

    MsgBox "You must select at least one product to create a proposal."

    End If

    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Do you have a line that hides or unloads the userform? You should only execute this line if at least one of the check boxes has been ticked.

  3. #3
    Star Lounger
    Join Date
    May 2009
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='775210' date='14-May-2009 11:54']Do you have a line that hides or unloads the userform? You should only execute this line if at least one of the check boxes has been ticked.[/quote]


    Hi Hans - thank you for the reply. I will try it out.
    Charlie
    charlie6067

  4. #4
    Star Lounger
    Join Date
    May 2009
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='charlie6067' post='775211' date='14-May-2009 11:58']Hi Hans - thank you for the reply. I will try it out.
    Charlie
    charlie6067[/quote]

    Hans - this worked fine except that the MsgBox didn't close when OK was clicked. How can it be closed so user can complete the form. Here's the new code. Thanks again for help.

    If VolDental.Value = False And _
    VolLife.Value = False And _
    VolLTD.Value = False And _
    VolSTD.Value = False Then
    MsgBox "You must select at least one product to create a proposal."

    Else

    frmProposal_Generator.Hide
    Selection.GoTo What:=wdGoToBookmark, Name:="bmkPolicyholder"

    End If

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    I can't explain that - a message box should always disappear when the user clicks OK.
    Is this problem persistent or was it a one-time glitch?

  6. #6
    Star Lounger
    Join Date
    May 2009
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='775285' date='14-May-2009 16:43']I can't explain that - a message box should always disappear when the user clicks OK.
    Is this problem persistent or was it a one-time glitch?[/quote]


    Hi Hans - I figured out I should have exited the sub at that point. It's working now. Thank you for the replies.

    Charlie
    charlie6067

Posting Permissions

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