Hello all,
I'm trying to add a rebuild feature to the below macro (it saves a file, then saves as dxf, pdf) after the initial save function. I've done some searches and copied some forcerebuild (false) codes, however nothing seems to be working.
Sub Main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
' Check to see if a drawing is loaded.
If swModel Is Nothing Then
swApp.SendMsgToUser ("To be used for drawings only, Open a drawing first and then TRY!")
' If no model currently loaded, then exit
Exit Sub
End If
If swModel.GetType <> swDocDRAWING Then
swApp.SendMsgToUser ("To be used for drawings only, Open a drawing first and then TRY!")
' If active file is not drawing, then exit
Exit Sub
End If
Set swDraw = swModel
If swDraw.GetPathName = "" Then
swDraw.Save
End If
<<<<IDEALLY REBUILD HERE>>>>>>>>
Filepath = Left(swDraw.GetPathName, InStrRev(swDraw.GetPathName, ".") - 1)
swDraw.SaveAs (Filepath + ".PDF")
swDraw.SaveAs (Filepath + ".DXF")
swDraw.SaveAs (Filepath + ".slddrw")
swApp.CloseDoc (swModel.GetTitle)
End Sub
Can someone please advise the best way to do this.