AnsweredAssumed Answered

Error in API

Question asked by Habib Ghalamkari on Apr 28, 2016
Latest reply on Apr 28, 2016 by Deepak Gupta

After upgrading solidworks 2016 to  sp3 all my macros are giving me type mismatch '13' error on the second line bellow.

 

Dim swModel As SldWorks.ModelDoc2

Set swModel = swApp.ActiveDoc

 

If I change the swModel declaration to

Dim swModel

everything works fine.

Is it a bag with sp3 or a corrupt installation for me?

 

Any kind of advice is much appreciated.

 

 

here's one of the macros:

     Dim swModel As SldWorks.ModelDoc2

    Dim swDraw As SldWorks.DrawingDoc

 

    Set swApp = Application.SldWorks

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    'Set swDraw = swModel

   

    swModel.AddCustomInfo3 "", "CompanyName", swCustomInfoText, "*********"

    swModel.AddCustomInfo3 "", "Material", swCustomInfoText, "SPCC, 1.6t"

    swModel.AddCustomInfo3 "", "Revision", swCustomInfoText, ""

    swModel.AddCustomInfo3 "", "Last Revision Date", swCustomInfoDate, Date

    swModel.AddCustomInfo3 "", "Author", swCustomInfoText, "******"

    swModel.AddCustomInfo3 "", "DateCompleted", swCustomInfoDate, Date

    swModel.AddCustomInfo3 "", "Description", swCustomInfoText, ""

    swModel.AddCustomInfo3 "", "Reference", swCustomInfoText, ""

    swModel.AddCustomInfo3 "", "Memo", swCustomInfoText, ""

    swModel.AddCustomInfo3 "", "Memo", swCustomInfoYesOrNo, vbYes

    swModel.AddCustomInfo3 "", "CheckedBy", swCustomInfoText, "*****"

    swModel.AddCustomInfo3 "", "CheckedDate", swCustomInfoDate, Date

   

    MsgBox "Done"

Outcomes