Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe I'm missing something, but this should be working...
Private WithEvents objCommandBarButton As CommandBarButton Private Sub Workbook_Open() Dim obkCommandbars As CommandBars Dim objCommandBar As CommandBar Dim objCommandBarControl As CommandBarControl ' Create a menu command on the "Tools" menu. objCommandBars = Me.Application.CommandBars("Tools") objCommandBar = objCommandBars.Item("Tools") ' Make sure menu command doesn't already exist. For Each objCommandBarControl In objCommandBar.Controls If objCommandBarControl.Caption = "Perform Metric conversion..." Then objCommandBar.Controls.Item("Perform Metric conversion...").Delete End If Next objCommandBarControl objCommandBarButton = objCommandBar.Controls.Add(msoControlButton) With objCommandBarButton .Caption = "Perform Metrics Conversion..." .Style = msoButtonCaption .Tag = "Perform Metrics Conversion..." .OnAction = "!<Magic_Metrics.Connect" .Visible = True End With End Sub Thanks, Jody W |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Jody, What error is this code giving you? at first glance It looks like you have a typo in your Dim statement Dim obkCommandbars As CommandBars should this read Dim objCommandbars As CommandBars ? -- bhofsetz ------------------------------------------------------------------------ bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807 View this thread: http://www.excelforum.com/showthread...hreadid=384612 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
bhofsetz wrote:
Jody, What error is this code giving you? at first glance It looks like you have a typo in your Dim statement Dim obkCommandbars As CommandBars should this read Dim objCommandbars As CommandBars ? Sorry for the double-post, first time using this newsreader. The main thread is under "Am I missing something???" The error I'm recieving is this: he error I'm getting is 'Object Required' on this line: ' Create a menu command on the "Tools" menu. Set objCommandbars = applicationObject.CommandBars I haven't done VBA/VB6 in a while since I have moved onto .NET. Thanks, Jody |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Connect a number to a picture bank and import that picture to exce | Excel Discussion (Misc queries) | |||
Insert Calculated Field (wrong Qty*Price = wrong Amount) | Excel Discussion (Misc queries) | |||
insert a picture in to a comment but picture not save on hard disk | Excel Discussion (Misc queries) | |||
What's wrong with this picture | Excel Programming | |||
What's wrong with this picture? VBA Date code.. | Excel Programming |