LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.charting,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Need help with adjusting width of VBA-created toolbars

Hello,
I am using VBA to create a series of toolbars, which are then assigned
to macros. The problem I am having is:
If I create a toolbar manually, it automatically adjusts its width to
whatever caption is specified. However, when I create a toolbar with
VBA, the width does not adjust itself to the caption, so the toolbar
is wider than neccessary. Here is an example of the code I am using:

Sub newButton3()
On Error Resume Next
CommandBars("C").Delete
Dim cBar, ccBar
CommandBars.Add.Name = "C"
Set cBar = CommandBars("C")
Set ccBar = CommandBars("C").Controls.Add(Type:=msoControlButt on)

With cBar
.Visible = True
.Left = 945
.Top = 260
.Controls.Add Type:=msoControlButton
.Controls(1).Caption = "UserSetIT"
.Controls(1).OnAction = _
"'C:\IFR Macros\MacroBank.xls'!UserSetit"
End With

With ccBar
.Style = msoButtonCaption
.TooltipText = "Allows User to Set CF and Span"
End With

End Sub

Any pointers/suggestions would be greatly appreciated. Thanks for any
help.

Mark
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Cell Width WITHOUT changing Column width dww701 Excel Discussion (Misc queries) 1 January 12th 09 10:52 PM
adjusting column width using keystrokes Lesliec4000 Excel Discussion (Misc queries) 1 May 18th 07 04:07 PM
ASC() does not convert full-width to half-width letters (Exel 2003 DY Excel Worksheet Functions 0 January 27th 07 01:34 PM
Toolbars Created in Excel 2002 not available in 2003 VBA Fun Excel Discussion (Misc queries) 3 August 25th 05 12:47 PM


All times are GMT +1. The time now is 01:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"