Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Creating a menu in code

I have VBA code that create's a new menu bar called "Process". The Code is
run when the worksheet opens. Problem is that it creates the menubar each
time the worksheet opens thus giving me multiple identicle menus. I need
some code to test to see if the menu has indeed been created, and if so not
to create it again. I have tried several different things with no luck. Any
help would be greatly appreciated.

Thanks in advance.

James D.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Creating a menu in code

Dim cb as Commandbar
On error resume next
set cb = Commandbars("Process")
On Error goto 0
if cb is nothing then
' create Process commandbar
end if

If Process is not a commandbar, but a button or something, just adjuste the
code, but the approach is the same.

--
Regards,
Tom Ogilvy

"James D." wrote in message
...
I have VBA code that create's a new menu bar called "Process". The Code

is
run when the worksheet opens. Problem is that it creates the menubar

each
time the worksheet opens thus giving me multiple identicle menus. I need
some code to test to see if the menu has indeed been created, and if so

not
to create it again. I have tried several different things with no luck.

Any
help would be greatly appreciated.

Thanks in advance.

James D.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Creating a menu in code

Before creating it, just delete it regardless

On Error Resume Next
Application.Commandbars("Process").Delete
On Error Goto 0

'now create anew

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"James D." wrote in message
...
I have VBA code that create's a new menu bar called "Process". The Code

is
run when the worksheet opens. Problem is that it creates the menubar

each
time the worksheet opens thus giving me multiple identicle menus. I need
some code to test to see if the menu has indeed been created, and if so

not
to create it again. I have tried several different things with no luck.

Any
help would be greatly appreciated.

Thanks in advance.

James D.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Creating a menu in code

Many thx, this is what I needed.

"Bob Phillips" wrote:

Before creating it, just delete it regardless

On Error Resume Next
Application.Commandbars("Process").Delete
On Error Goto 0

'now create anew

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"James D." wrote in message
...
I have VBA code that create's a new menu bar called "Process". The Code

is
run when the worksheet opens. Problem is that it creates the menubar

each
time the worksheet opens thus giving me multiple identicle menus. I need
some code to test to see if the menu has indeed been created, and if so

not
to create it again. I have tried several different things with no luck.

Any
help would be greatly appreciated.

Thanks in advance.

James D.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Creating a menu in code

Many thx, this is what I needed.

"Tom Ogilvy" wrote:

Dim cb as Commandbar
On error resume next
set cb = Commandbars("Process")
On Error goto 0
if cb is nothing then
' create Process commandbar
end if

If Process is not a commandbar, but a button or something, just adjuste the
code, but the approach is the same.

--
Regards,
Tom Ogilvy

"James D." wrote in message
...
I have VBA code that create's a new menu bar called "Process". The Code

is
run when the worksheet opens. Problem is that it creates the menubar

each
time the worksheet opens thus giving me multiple identicle menus. I need
some code to test to see if the menu has indeed been created, and if so

not
to create it again. I have tried several different things with no luck.

Any
help would be greatly appreciated.

Thanks in advance.

James D.




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
Creating sub menu in Command bar Troispieds Excel Programming 5 June 20th 07 05:23 PM
Menu Issues when creating an Add-in ExcelMonkey[_190_] Excel Programming 1 February 7th 05 12:15 PM
Creating a menu Frenchy Excel Worksheet Functions 1 December 11th 04 03:35 PM
Creating a drop-down menu Chris Excel Programming 0 September 16th 03 10:08 PM
Creating a drop-down menu Chris Excel Programming 0 September 16th 03 10:08 PM


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