Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to resize Commandbar

Status
Not open for further replies.

sigrist

Programmer
Apr 24, 2011
2
The code creates a menu in the commandbar, where all of the buttons reach too far, however I am not able to resize it via the .Width command.

I have tried in Word 2007 and 2010.

Can you help me?

Thanks

Daniel



Sub Menu()
Dim cbrWiz As CommandBar
Dim ctlInsert As CommandBarButton
On Error Resume Next
Set cbrWiz = CommandBars("Menu")
If cbrWiz Is Nothing Then
Err.Clear
Set cbrWiz = CommandBars.Add("Menu")
' Add button control.
For x = 1 To 20 Step 1
Set ctlInsert = cbrWiz.Controls.Add
With ctlInsert
.Caption = "The text in this field is very long................" & x
.Style = msoButtonCaption
.TooltipText = "Macro" & x
.Tag = "NewMacros" & x
.OnAction = "Button" & x
End With
Next x
cbrWiz.Visible = True
cbrWiz.Width = 60

Else
cbrWiz.Visible = True
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top