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: 3
Default Repeating Menu item

Hi Gang,

I have a weird situation I can't get my head around.

I have created a macro that call a calendar control to make it easier to add
dates into my spreadsheet.

I also added the functionality to the right click context menu with the
following code (added to Personal.xls):


Private Sub Workbook_Open()

Dim NewControl As CommandBarControl
Application.OnKey "+^{C}", "ThisWorkbook.OpenCalendar"
Set NewControl = Application.CommandBars("Cell").Controls.Add

With NewControl
.Caption = "Insert Date"
.OnAction = "Module1.OpenCalendar"
.BeginGroup = True
End With
End Sub
It works fine, but every time I closed and re-open the worksheet a new
Insert data item is added to the menu (I currently have 14).

I tried adding:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set NewControl = Nothing
End Sub

but this did not seem to work either.

Any suggestions would be much appreciated.

Steve



 
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
can i avoid repeating rows when adding calculated item in pivot ta sophie Excel Worksheet Functions 4 January 7th 08 07:50 AM
Add menu item to right-click menu [email protected] Excel Programming 1 July 15th 06 10:32 AM
Adding Sub Menu Item to Current Custom Menu Renato Excel Programming 2 December 19th 05 12:48 AM
Menu items added with menu item editor in older versions Michael Hoffmann Excel Discussion (Misc queries) 2 January 7th 05 01:40 PM
Adding a menu item right click menu when clicking on a single. Andoni[_28_] Excel Programming 0 September 2nd 04 10:23 PM


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