LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default Custom Context menu (Right click menu) not working in sheet changeevent.

Hi all,
I face a small problem.

Following code works fine.
Sub ADD_COMMAND()
CommandBars("Cell").Reset
With Application.CommandBars("Cell").Controls
With .Add
.Caption = "OGP"
.OnAction = ThisWorkbook.Name & "OGP"
.Tag = OGPTAG
.BeginGroup = True
' .Temporary = True <<<<<< THIS LINE NOT WORKING
SO COMMENTED OUT
End With
End With
CommandBars("cell").Controls("OGP").FaceId = 44
End Sub

However, If I place the same code in worksheet activate event it does
not work.
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name < "ALVXXL01" Then
Exit Sub
End If
CommandBars("Cell").Reset <<<<<< error out
here .
With Application.CommandBars("Cell").Controls
With .Add
.Caption = "OGP"
.OnAction = ThisWorkbook.Name & "OGP"
.Tag = OGPTAG
.BeginGroup = True
' .Temporary = True
End With
End With
CommandBars("Cell").Controls("OGP").FaceId = 44
End Sub

Can somebody point out the mistake I am making please.

Regards,
Madiya
 
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
Right click Drag and Drop context menu Al_Raiani Excel Programming 0 June 28th 07 07:46 PM
access [contextual||context||right-click] [menu||commandbar] of ch mrmack Excel Programming 0 June 21st 06 09:32 AM
Context-sensitive custom menu item. Murray Excel Programming 7 December 28th 05 04:55 AM
Right-Click (Context Menu) Kryptonix Excel Programming 6 October 25th 05 03:59 PM


All times are GMT +1. The time now is 12:01 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"