troubleshooting Question

Set Default Button in a VBA form

Avatar of JohnRobinAllen
JohnRobinAllenFlag for Canada asked on
Microsoft Word
5 Comments1 Solution995 ViewsLast Modified:
I am working with VBA in a Word document. I have a form that contains a message and up to three buttons beneath the message so the user can choose what to do. I want to make one of the buttons be the default button that I specify with the integer variable DefaultButton. None of the buttons has a set default,  and I am trying to use this routine to specify which button should be the default:
Select Case DefaultButton
            Case Is = 0
                  frmJRABox.cbButton1.Default = True
            Case Is = 1
                  frmJRABox.cbButton2.Default = True
            Case Is = 2
                  frmJRABox.cbTranslate.Default = True
      End Select

When I step through the code it goes to the specified line, but the result is nil. Nothing gets specified as the default button.

Can anyone suggest what I am doing that prevents the above code from working?
I’ll try any suggestions. Thanks for any help.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2012

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros