Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Run-time error '438' (Excel xp)

    I have a whole suite of macros that i put together in an add-in. I have a custom menu that calls them up. However, when i first open excel i get an error, Run-Time error '438', object doesn't support property or method. I have combed thru the code, compiled it etc. and don't get any errors. I can run all the macros without errors, so i think it is something to do with the menu... here is my code

    attached is a text file with the code
    what method or property is wrong? thank you for the help.

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

    Re: Run-time error '438' (Excel xp)

    You define the 7th control of your menu as a control button, not a popup:

    With smacropop.Controls
    ...
    .Add Type:=msoControlButton '7 shortcuts
    End With

    Therefore, referring to its controls fails, since a button has no (sub) controls:

    Set smacropop7 = smacropop.Controls(7) 'print something
    With smacropop7.Controls
    ...

  3. #3
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Run-time error '438' (Excel xp)

    thank you...it's all better now.

  4. #4
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Run-time error '438' (Excel xp)

    yes, well that was the weird problem. usually the line is highlighted but this time it wasn't so i couldn't figure out where the error was and didn't know how to debug it. thanks for the help in finding the error. it was driving me crazy.

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

    Re: Run-time error '438' (Excel xp)

    I'm glad it works

    For future problems: how do you investigate something like this?

    When you run into an error, and if you haven't set error handling, the Visual Basic Editor doesn't just generate a runtime error message, but pauses at the offending line and highlights it. Although this is not always 100% informative, you often get a good idea of where the problem is. In this case, the line "With smacropop7.Controls" was highlighted, so Controls had to be the property that is not supported. Investigating how smacropop7 is defined leads you to an explanation.

    If you don't manage to solve the problem yourself, and decide to post it in the Lounge, it helps to mention which line was highlighted. It saves time for Loungers who want to investigate the problem.

Posting Permissions

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