Macro broke in 2006

Discussion in 'SolidWorks' started by TOP, Sep 1, 2006.

  1. TOP

    TOP Guest

    Since installing 2006 some macros don't work. I stepped through and the
    problems start right here:


    Set swApp = CreateObject("SldWorks.Application")

    When I step past this line swApp = nothing.
     
    TOP, Sep 1, 2006
    #1
  2. TOP

    fcsuper Guest

    Make sure the proper Reference libraries are attached to the macro. On
    some systems, macros are not automatically jumped up to the current
    libraries. You still may have 2005 or previous libraries attached
    instead. This is a good first check if you encounter this issue.
     
    fcsuper, Sep 1, 2006
    #2
  3. Go read the thread called "Question for Wayne Tiffany" and you might find
    the same issue with yours - sounds like the same thing I ran into then.
    Basically here is the supplied answer:

    "Please remove the SldWorks type library reference, close the references
    dialog, add it back again, and save. This should fix the issue."

    WT
     
    Wayne Tiffany, Sep 1, 2006
    #3
  4. TOP

    TOP Guest

    Actually the fix was:

    Set swApp = Application.SldWorks

    Why this now works and the other doesn't I'll leave for others to
    explain.
     
    TOP, Sep 1, 2006
    #4
  5. TOP

    Tim Markoski Guest


    Both methods are fine.

    You can also use

    Dim swApp As SldWorks.Application

    Set swApp = New SldWorks.Application


    The problem is caused by the Class IDs changing from the last build.

    A previous reference won't work if the Class IDs have changed
     
    Tim Markoski, Sep 1, 2006
    #5
  6. TOP

    TOP Guest

    Just an update on this problem. Apparently just moving a type
    definition priority in TOOLS/REFERENCES is all that is needed to get
    things back on track. The trick is to get VBA to reread the typ def
    libraries.
     
    TOP, Sep 6, 2006
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.