Share via

VBA msgbox for checkbox

Anonymous
2024-05-21T20:37:34+00:00

Hello All,

Attempting to learn vba through videos so please bear with me.

I was able to create a userform with multiple checkboxes for different scenarios. I am attempting to create or would like a msgbox to appear if checkbox 15 and checkbox 16 = false and the message to appear as "Appropriate disclosure was not selected. Please select correct disclosure in order to proceed."

How do I go about doing so? Please help.

Thank you in advance for your assistance.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2024-05-22T20:05:24+00:00

    You apparently are using and an auto_open macro to display your userform. Use and auto_new instead

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-05-22T18:33:25+00:00

    @ Doug Robbins and @ Greg Maxey

    Thank you both for your help on this project. Both scenarios work perfectly. However, when I save the output document and open it, the userform dashboard also appears. The project is saved as a Word macro enable template.

    How do I get rid of the dashboard or how do I save the output file as a regular Word document so that the dashboard does not come up again?

    Thank you again in advance for your assistance.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-05-22T17:24:08+00:00

    Personally, I like to have my "execute" button disabled until all conditions are met. I would set the default of my command button .enabled property to "false" then use something like:

    Private Sub CheckBox15_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Validate
    End Sub
    Private Sub CheckBox16_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Validate
    End Sub
    Private Sub SomeSubsequentControl_Enter()
    Validate
    End Sub
    Sub Validate()
    If Not CheckBox15 And Not CheckBox16 Then
    MsgBox "Your message"
    CommandButton1.Enabled = False
    Else
    CommandButton1.Enabled = True
    End If
    End Sub

    Was this answer helpful?

    0 comments No comments
  4. Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
    2024-05-22T10:07:35+00:00

    Use the following code in the Exit event for Checkbox16

    If Checkbox16 = False then

    If Checkbox15) =False then

        Msgbox "Both checkboxes as False
    

    End If

    End If

    Was this answer helpful?

    0 comments No comments