AnsweredAssumed Answered

Macro not combining custom properties

Question asked by Fraser Port on Jun 7, 2018
Latest reply on Jun 8, 2018 by Christian Chu


I have been using the macro below (originally from Deepak Gupta to add the @drawing revison to PDFs which works perfectly. Now Im trying to combine it with a minor revison property (from the drawing called MINOR REVISION).

The result now only add the minor revision property to the file name.


How do I combine the two properties?




Sub main()


Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc


If swModel Is Nothing Then End


DateiMitPfad = swModel.GetPathName()

If DateiMitPfad = "" Then

    MsgBox ("Please Save First!")


End If


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

swCustPrpMgr.Get3 "REVISION", False, "", Value


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

swCustPrpMgr.Get3 "MINOR REVISION", False, "", Value


sFilePath = Left(swModel.GetPathName, InStrRev(swModel.GetPathName, "\"))


FileName = Mid(swModel.GetPathName, InStrRev(swModel.GetPathName, "\") + 1)

FileName = Left(FileName, InStrRev(FileName, ".") - 1)


sFilePath = sFilePath


If Value = "" Then

FileName = sFilePath & FileName


FileName = sFilePath & FileName & "_rev" & Value

End If


swModel.SaveAs2 FileName + ".PDF", 0, True, False


End Sub