AnsweredAssumed Answered

How to check for an open file

Question asked by Peter Brinkhuis on Oct 6, 2015
Latest reply on Oct 7, 2015 by Peter Brinkhuis

Hi all,


I've been working on a macro to open all configurations of a file and export them to STEP and other formats. It gets better, more complex en more user friendly over time, but it crashes when no file is opened before the macro is executed. The macro is meant to be used after a file is opened, but I'd like to be able to handle the other possibility.


The first few lines are, as always:

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

This works, but swModel keeps a value of "nothing" as no file opened. The macro then crashes when I try to do the following:

Set custPropMan = swModel.Extension.CustomPropertyManager("")

What would be the best way to check if there is a file open in SW? If I know the answer to this question, I'm sure I can figure out a way to create an "open file" window.