Custom commandbar, submenu questions

D

Dale Fye

1. When I added the code below to a test menu, the triangle that pops up
next to "Error" (to indicate a submenu) in the main menu shows up on the line
below the text rather than on the same line as the text. I'm sure there is
something simple that I am missing. Any ideas

2. In the sub Check_Errors, I want to enable the "Review Errors" menu item,
but cannot figure out the correct syntax to enable a submenus control.

Set CmdBarSub = CmdBar.Controls.Add(Type:=msoControlPopup)
With ctrl
.Caption = "Error"
End With

Set ctrl = CmdBarSub.Controls.Add(Type:=msoControlButton)
With ctrl
.Caption = "Check Errors"
.OnAction = "Check_Errors"
End With
Set ctrl = CmdBarSub.Controls.Add(Type:=msoControlButton)
With ctrl
.Caption = "Review Errors"
.OnAction = "Review_Errors"
.Enabled = False
End With
 
J

Jim Rech

I do not see the first problem.

Re enabling the control later. If you assign a Tag to the control you use
it later:

Assign Tag property:

With ctrl
.Caption = "Review Errors"
.OnAction = "Review_Errors"
.Enabled = False
.Tag = "RevErrors"
End With

and later:

CommandBars.FindControl(Tag:="RevErrors").Enabled = True

--
Jim
| 1. When I added the code below to a test menu, the triangle that pops up
| next to "Error" (to indicate a submenu) in the main menu shows up on the
line
| below the text rather than on the same line as the text. I'm sure there
is
| something simple that I am missing. Any ideas
|
| 2. In the sub Check_Errors, I want to enable the "Review Errors" menu
item,
| but cannot figure out the correct syntax to enable a submenus control.
|
| Set CmdBarSub = CmdBar.Controls.Add(Type:=msoControlPopup)
| With ctrl
| .Caption = "Error"
| End With
|
| Set ctrl = CmdBarSub.Controls.Add(Type:=msoControlButton)
| With ctrl
| .Caption = "Check Errors"
| .OnAction = "Check_Errors"
| End With
| Set ctrl = CmdBarSub.Controls.Add(Type:=msoControlButton)
| With ctrl
| .Caption = "Review Errors"
| .OnAction = "Review_Errors"
| .Enabled = False
| End With
|
| --
| Don''t forget to rate the post if it was helpful!
|
| Email address is not valid.
| Please reply to newsgroup only.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top