I have a macro that does a "save and close all" however the issue is if I create a file and haven't saved it yet the macro doesn't actually save the file, it just trashes it out and moves to the next file. I have read through many of the posts on getting the common dialog window but I'm at a loss as to fix what I have so I get the saveas dialog to save the file(s).
Here is what I have so far:
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim nErrors As Long
Dim nWarnings As Long
Dim bRet As Boolean
Set swApp = Application.SldWorks
'close all files not needing to be saved
swApp.CloseAllDocuments (False)
Set swModel = swApp.ActiveDoc
While Not swModel Is Nothing
If swModel.GetSaveFlag Then
bRet = swModel.Save3(swSaveAsOptions_Silent, nErrors, nWarnings)
Debug.Print "File = " & swModel.GetPathName
Debug.Print " bRet = " & bRet
Debug.Print " Errors = " & nErrors
Debug.Print " Warnings = " & nWarnings
End If
Debug.Print "Closing: " & swModel.GetPathName
swApp.QuitDoc swModel.GetTitle
swModel = swModel.GetNext
Wend
End Sub
SolidworksApi macros