ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
BMBrian Mick13/05/2014

Hello,

I have a macro that makes new drawings, and it saves them per a part number I am supplying with a message box.  If I make an error, the macro will over-write existing files.  I do not want it to do this. 

I found this code in a previous discussion:

If System.IO.File.Exists("K:\Models\" + FileName + ".SLDDRW") Then

    MsgBox ("File Already Exists")

    End

End If

But it gives me "Compile Error: Method or data member not found"

I am using the SaveAs method from the SldWorks.ModelDoc2 object.  Is there a way to prevent overwriting existing files?

Thanks so much!