View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] peterF@lgn.com is offline
external usenet poster
 
Posts: 1
Default Problem getting a msoButtonDown status

'
How can I tell is a button on a menu item is checked?

I am using this code

If (TG8.State = msoButtonDown) Then
bMenuAllWorksheetsOption = True
End If

however even if the button is not checked, the If statement indicates
that it is.

tia


Private TG1 As CommandBarButton

Sub Auto_Open()

On Error Resume Next
CommandBars(1).Controls("myTools").Delete

' Find the Help Menu
Set HelpMenu = CommandBars(1).FindControl(ID:=30010)

If HelpMenu Is Nothing Then
'Add the menu to the end
Set NewMenu = CommandBars(1).Controls.Add _
(Type:=msoControlPopup, _
temporary:=True)
Else
'Add the menu before Help
Set NewMenu = CommandBars(1).Controls.Add _
(Type:=msoControlPopup, _
Befo=HelpMenu.Index, _
temporary:=True)
End If

' Add a caption for the menu
NewMenu.Caption = "&myTools"

' OPTIONS MENU ITEM
Set MenuItem = NewMenu.Controls.Add _
(Type:=msoControlPopup)
With MenuItem
.Caption = "&Options"
.BeginGroup = True
End With

' OPTIONS MENU ITEM - FIRST SUBMENU ITEM
Set Submenuitem = MenuItem.Controls.Add _
(Type:=msoControlButton)
With Submenuitem
.Caption = "OPTIONS MESSAGES: Show &Range Selected"
.OnAction = "MenuSetRangeSelectedOption"
End With

bMenuActiveWorksheetOption = True
Set TG1= MenuItem.Controls("OPTIONS RANGE: Use SELECTED
W&orksheet")
TG1State = msoButtonDown
'MsgBox "TG7 " & MenuItem.Controls("OPTIONS RANGE: Use SELECTED
W&orksheet").ID


End Sub

Sub CheckButtonAndBooleanStatus()


On Error Resume Next
If (TG8.State = msoButtonDown) Then
bMenuAllWorksheetsOption = True
End If

End Sub