+ Reply to Thread
Results 1 to 3 of 3

CommandBar Problem

  1. #1
    Forum Contributor
    Join Date
    10-02-2008
    Location
    Berkeley, CA
    MS-Off Ver
    Windows 2007
    Posts
    105

    CommandBar Problem

    I use John Walkenbach's Menu Creation code in Excel 2003:

    Please Login or Register  to view this content.
    In some programs this code works and in some programs is doesn't. Where it doesn't I get the following message from executing the "Set MenuObject..." Expression: "Run-time Error 9, Subscript out of range." The only subscript is the "1". Note that cBar which is set to CommandBars(1) works.

    If I've run a program that works first and then run a program which by itself creates this error, no error occurs.

    How to fix this?

    Thanks, Mac

  2. #2
    Forum Contributor
    Join Date
    10-02-2008
    Location
    Berkeley, CA
    MS-Off Ver
    Windows 2007
    Posts
    105

    Post Re: CommandBar Problem

    Bump
    So thanks if you look at this.
    Mac

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: CommandBar Problem

    Hello Mac,

    I would check that the variable "PositionOrMacro" is not empty. Since this is a Variant type, you should check if the Variant contains any valid data by using the IsEmpty method. Place this check before the "Select" statement.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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