+ Reply to Thread
Results 1 to 5 of 5

Creating a menu in code

  1. #1
    James D.
    Guest

    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. #2
    Tom Ogilvy
    Guest

    Re: 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." <JamesD@discussions.microsoft.com> wrote in message
    news:D98FCFDC-C64C-4B38-913A-7C0289D27FD7@microsoft.com...
    > 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. #3
    Bob Phillips
    Guest

    Re: 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." <JamesD@discussions.microsoft.com> wrote in message
    news:D98FCFDC-C64C-4B38-913A-7C0289D27FD7@microsoft.com...
    > 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. #4
    James D.
    Guest

    Re: 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." <JamesD@discussions.microsoft.com> wrote in message
    > news:D98FCFDC-C64C-4B38-913A-7C0289D27FD7@microsoft.com...
    > > 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. #5
    James D.
    Guest

    Re: 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." <JamesD@discussions.microsoft.com> wrote in message
    > news:D98FCFDC-C64C-4B38-913A-7C0289D27FD7@microsoft.com...
    > > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1