Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Adding and Removing Custom Menu Items for one file...

I created a vba program in excel that creates a menu item on the main menu
bar when the file is opened and remove it when the file is closed. I use
the Workbook_Open and Workbook_BeforeClose functions. However, if I open
the file twice it gives me 2 of the menu items, and when I exit only the
file and not the application, the menu items remain. Is there a way to get
it to only add them menu item when the file is opened and then remove it
when that file is closed???? Thanks for the help.

--Jon


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Adding and Removing Custom Menu Items for one file...

Jon,

In your Workbook_Open macro first delete than build...

On Error Resume Next
Application.CommandBars("mybar").Delete
On Error GoTo 0

--
sb
"Jon Kane" wrote in message
...
I created a vba program in excel that creates a menu item on the main menu
bar when the file is opened and remove it when the file is closed. I use
the Workbook_Open and Workbook_BeforeClose functions. However, if I open
the file twice it gives me 2 of the menu items, and when I exit only the
file and not the application, the menu items remain. Is there a way to

get
it to only add them menu item when the file is opened and then remove it
when that file is closed???? Thanks for the help.

--Jon




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Adding and Removing Custom Menu Items for one file...

Hi,



If MyMenu.Visible=True then exit sub



Your menu won't be added twice.




--
JP

http://www.solutionsvba.com


"Jon Kane" wrote in message
...
I created a vba program in excel that creates a menu item on the main menu
bar when the file is opened and remove it when the file is closed. I use
the Workbook_Open and Workbook_BeforeClose functions. However, if I open
the file twice it gives me 2 of the menu items, and when I exit only the
file and not the application, the menu items remain. Is there a way to

get
it to only add them menu item when the file is opened and then remove it
when that file is closed???? Thanks for the help.

--Jon




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
Removing Pivit Table Items Dave Charts and Charting in Excel 2 January 4th 09 01:12 AM
removing single items from list jenn Excel Worksheet Functions 6 November 8th 08 02:28 PM
File & Help only active menu items hill0821 Excel Discussion (Misc queries) 7 December 21st 06 10:58 PM
Menu items added with menu item editor in older versions Michael Hoffmann Excel Discussion (Misc queries) 2 January 7th 05 01:40 PM
Deleting custom Commands from File Menu are nor saved next time w. EXCEL CUstomization Excel Worksheet Functions 3 December 7th 04 01:46 AM


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