Link to home
Start Free TrialLog in
Avatar of Mattie Owens
Mattie Owens

asked on

Content Control Event Firing randomly

I got this script here, and I thought it was working but appears to run when other controls are clicked as well. Is there  solution. I only want the macro to run if I select either Item 1 or Item 2.

Sub MainMacro()
    Dim cc As ContentControl
    Set cc = ActiveDocument.ContentControls(1)
    Select Case cc.Range.Text
        Case "Item 1"
            Call Macro1
        Case "Item 2"
            Call Macro2
    End Select
End Sub

Sub Macro1()
    MsgBox "One"
End Sub

Sub Macro2()
    MsgBox "Two"
End Sub
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

can you upload a sample document and indicate what you need to do within that document?
Avatar of Mattie Owens
Mattie Owens

ASKER

Here is a sample. I cannot upload the original.
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Learning so much. Thanks for your help again.