Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default XL2003 VBA Add msoControlButton BUG or Feature?

Using VBA I am trying to add a simple button to CommandBars(1). The
result of the code below is the button is created but the Caption is
missing. From the immediate window, the Caption Property contains the
value I assigned in the code, it just refuses to display on the
toolbar. This has worked for me hundreds of times in XL2k. Can you
help?

Sub AddUCXButton()
'
On Error Resume Next
DeleteUCXButton
Dim MenuObject
Set MenuObject = Application.CommandBars(1). _
Controls.Add(Befo=11, _
Type:=msoControlButton, Temporary:=True)

MenuObject.Caption = "&UCX830"
MenuObject.OnAction = "RunAMacro"
End Sub

TIA
Ror
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default XL2003 VBA Add msoControlButton BUG or Feature?

What is the style setting for the button? Does it include showing the
caption?

--
Regards,
Tom Ogilvy

"rormeister" wrote in message
m...
Using VBA I am trying to add a simple button to CommandBars(1). The
result of the code below is the button is created but the Caption is
missing. From the immediate window, the Caption Property contains the
value I assigned in the code, it just refuses to display on the
toolbar. This has worked for me hundreds of times in XL2k. Can you
help?

Sub AddUCXButton()
'
On Error Resume Next
DeleteUCXButton
Dim MenuObject
Set MenuObject = Application.CommandBars(1). _
Controls.Add(Befo=11, _
Type:=msoControlButton, Temporary:=True)

MenuObject.Caption = "&UCX830"
MenuObject.OnAction = "RunAMacro"
End Sub

TIA
Ror



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default XL2003 VBA Add msoControlButton BUG or Feature?

Hi Tom,

Thanks for the reply. Yes, it seems that XL2003 requires the style
attribute to be set. XL2000 is more forgiving in that if you don't
specificly imply that the button is an msoButtonCaption, the fact you
set the caption value seems to be enough.

What is puzzling, the code without the Style works for workbooks that
were created in XL2000, but requires Style in new XL2003 worksheets.

Thanks again!

"Tom Ogilvy" wrote in message ...
What is the style setting for the button? Does it include showing the
caption?

--
Regards,
Tom Ogilvy

"rormeister" wrote in message
m...
Using VBA I am trying to add a simple button to CommandBars(1). The
result of the code below is the button is created but the Caption is
missing. From the immediate window, the Caption Property contains the
value I assigned in the code, it just refuses to display on the
toolbar. This has worked for me hundreds of times in XL2k. Can you
help?

Sub AddUCXButton()
'
On Error Resume Next
DeleteUCXButton
Dim MenuObject
Set MenuObject = Application.CommandBars(1). _
Controls.Add(Befo=11, _
Type:=msoControlButton, Temporary:=True)

MenuObject.Caption = "&UCX830"
MenuObject.OnAction = "RunAMacro"
End Sub

TIA
Ror

Reply
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
XL2007 and XL2003 LeeCC Excel Discussion (Misc queries) 2 December 18th 08 04:44 PM
How to increase size of image in button (msocontrolbutton) of custom toolbar of Excel padam Excel Discussion (Misc queries) 0 August 11th 06 07:18 PM
XL2003 Add Ins Melissa[_2_] Excel Programming 1 October 22nd 03 07:24 PM
xl2003 and VS Alex T Excel Programming 2 September 22nd 03 10:26 AM
xl2003 GUS Excel Programming 0 September 18th 03 08:16 PM


All times are GMT +1. The time now is 10:07 AM.

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

About Us

"It's about Microsoft Excel"