Thread: Option Buttons
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Option Buttons

This is an example of code that sets/unsets a checkmark when a menu is
clicked, It goes in the macro assigned to the menu item in OnAction.

With Application.CommandBars.ActionControl
If .State = msoButtonUp Then
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetHidden
.State = msoButtonDown
Else
ActiveWorkbook.Worksheets(.Caption).Visible = xlSheetVisible
.State = msoButtonUp
End If
End With

Set it initially like so

Set octl = CommandBars("Worksheet Menu Bar").Controls("Tools").Controls("My
Test")
oCtl.State = msoButtonDown


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"HSalim[MVP]" wrote in message
...
Hi,
I have a workbook with a few VBA macros. Some of those macros are

assigned
to a custom toolbar.
On that custom toolbar, I want to add a checkbox or option button, to
indicate a true/false state.
If true then checked image else unchecked image
I need this in some coditional programming in a macro, I will need to

check
the state of the checkbox when the macro is executed.

Is this possible on a toolbar?

Thanks in advance
Habib


--
www.DynExtra.com
A resource for the Microsoft Dynamics Community
Featuring FAQs, File Exchange and more
Current member count: 40
--------------------------------------------
Share your knowledge. Add your favorite questions and answers
Help add questions to this site! We want Your input.
--------------------------------------------