AnsweredAssumed Answered

Macro prevents Solidwork from Opening Files and Running

Question asked by Peter Kennedy on Apr 6, 2017
Latest reply on Apr 11, 2017 by Peter Kennedy

I'm looking for help on how to trouble shoot this issue, I wrote a macro to to save a drawing in a various file types, the macro works as intended and there is no issues or errors when the macro runs however after running the macro I can't open new or existing files. I can make changes to file currently open and save them with no issues and then as soon as I go to close solidworks it crashes.


I've been talking with my VAR however they haven't been able to determine an issue yet.


Here is the solidworks object being used:


'Setting up all the variables

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swDraw As SldWorks.DrawingDoc

Dim swRefModelExt As ModelDocExtension

Dim swCustPropMgr As SldWorks.CustomPropertyManager

Dim swView As SldWorks.View

Dim swDrawComp As SldWorks.DrawingComponent

Dim swComp As SldWorks.Component2

Dim swRefModel As SldWorks.ModelDoc2

Dim swLayerMgr As SldWorks.LayerMgr

Dim swLayer As SldWorks.Layer

Dim swPageSetup As SldWorks.PageSetup

Dim printSpec As SldWorks.PrintSpecification

Dim swModelDocExt As SldWorks.ModelDocExtension

Dim swExportPDFData As SldWorks.ExportPdfData


The VAR thought it might be related to this line:


    'Set the printing specs

    Set printSpec = swModelDocExt.GetPrintSpecification


I have commented this out and the issue still happens.


I would perfer not to share the code for this, and I'm just looking for any advice on how to try and trouble shoot the issue.


I'm running 2015 SP 5.0.