Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Location
    Virginia Beach, Virginia, USA
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts

    OnAction oddity (2003)

    I am confused once again.
    I have a toolbar which calls various subroutines in an add-in. One of the buttons works are expected. The other 5 do not work at all. They report "The macro .. could not be found." All the macros are in the same module in an add-in. When the Isaddin? property is false on the xla, everything works fine. Set it to true an only one button works. The OnAction string is the same except for the last few characters define the macro.

    Any ideas?

    For this application, I can live IsAddIn? being false. However, I hate to be this close and having to settle.

  2. #2
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: OnAction oddity (2003)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> There

    Try and explicitly point to the code so that the button can find it.

    Workbook name | Module Name | Proc Name...

    Are you passing any arguments or variables to these, that can also do it...

    Tell us if you need more help.

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  3. #3
    Star Lounger
    Join Date
    Feb 2001
    Location
    Virginia Beach, Virginia, USA
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OnAction oddity (2003)

    The OnAction string contains the complete filepath/filename/macro. Similar to the following (The only difference being the text after the _)
    'Cocuments and SettingsAll UsersDocumentsCBBTAnnualInspection.xla'!Inspect_Be nt

    There are no arguments to the subs. The subs are explicitly listed as public.

    Interrestingly, the macros that do not work, also do not run from the Tools-> macro. While the one that does work can be accessed in that manor.

  4. #4
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: OnAction oddity (2003)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> gibbindr

    You said <font color=blue><<< Interrestingly, the macros that do not work, also do not run from the Tools-> macro. While the one that does work can be accessed in that manor. >>> </font color=blue>

    I think these ones that don't work may have an argument or a variable passed to them, and this is one reason why they don't show up in the Macros window.

    Did you try to Call these ones that don't work: Call Proc name from a sub?

    Try and look to see if the path is not being truncated some where along the way. Possibly change the <font color=blue>_</font color=blue> to nothing and test one and see what is going on. Possibly the path is getting too long for the system to handle, and then you have this thing happen. Try and isolate the path that is working, and then see how many characters it has, and make the other than same number.

    These are all suggestions, and they are <img src=/S/free.gif border=0 alt=free width=30 height=15>.

    Cordially

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: OnAction oddity (2003)

    Try assigning just the macro name, without the name and path of the add-in:

    Application.CommandBars("My Toolbar").Controls(1).OnAction = "Inspect_Bent"

    or

    Application.CommandBars("My Toolbar").Controls("My Button").OnAction = "Inspect_Bent"

    It's strange that one of the macros in the add-in is visible in Tools | Macro | Macros... Are you sure this is not a macro of the same name in another workbook (for example in your Personal.xls)?

  6. #6
    Star Lounger
    Join Date
    Feb 2001
    Location
    Virginia Beach, Virginia, USA
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OnAction oddity (2003)

    "Are you sure this is not a macro of the same name in another workbook "
    Very close to the actual problem.

    Although the macros did not exist in other open workbooks, they did at one time. And that seems to be the problem.
    I copied the worksheets to a new book, copied the one module (has _Open code) into the same new book. Closed the original file and everything now works.

    Thanks for the ideas. They gave me some ideas on what was really going on.

Posting Permissions

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