LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default In-place CommandBar.Add run-time error

I have an excel embeded in a word. I edit the excel in-place and i want when
the user tries to open the context menu to show another context menu. But an
error appears: Run-time error '-2147467259 (80004005)':

Method 'Add' of Object '_CommandBars' failed

Here is the method:

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Dim myBar As CommandBar
Dim barOpen As CommandBarButton
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''
' This is where i get that error
Set myBar = Application.CommandBars.Add(Name:="MyCustomButton" ,
Position:=msoBarMenuBar, temporary:=True)
'''''''''''''''''''''''''''''''''''''''''''''''''
Set barOpen = myBar.Controls.Add(Type:=msoControlButton, ID:=1,
temporary:=True)
With barOpen
.Caption = "Open"
.OnAction = "Sheet1.Open"
End With
End Sub

Is there a way to do this? Do you have another solution?

Thanks
 
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
Creating a Work place time sheet. Dags Excel Worksheet Functions 1 July 15th 07 07:56 AM
Place a Dynamic Date + a Certain Time in a Cell Sean Excel Worksheet Functions 3 January 6th 07 05:37 PM
How do place a column of date/time information into a calendar for Linuxster Excel Discussion (Misc queries) 0 December 3rd 05 12:56 AM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
commandbar problems Richard Cook Excel Discussion (Misc queries) 1 July 8th 05 05:32 PM


All times are GMT +1. The time now is 06:18 PM.

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"