Hi,
I am modifying an existing macro to save a drawing as a pdf document in specific file location with the revision in the filename. The macro now does both of these things however the filename is not correct. The pdf should be named with the same name as the drawing, instead it is saved with the same name as the drawing plus the sheet name, e.g. SG828456DML - Sheet1_A00 instead of SG828456DML_A00 (SG828456DML is the name of the drawing and _A00 is the revision).
Public Sub main()
Dim swDoc As ModelDoc2 = Nothing
Dim longstatus As Integer = 0
swDoc = CType(swApp.ActiveDoc, ModelDoc2)
Dim FilePath As String = ""
Dim FileRevision As String = ""
Dim NewFilePath1 As String = ""
Dim NewFilePath2 As String = ""
FilePath = swDoc.GetTitle
FileRevision = swDoc.GetCustomInfoValue("", "Révision")
NewFilePath2 = (FilePath & "_" & FileRevision)
NewFilePath1 = Path.ChangeExtension("S:\Wide\Gattlen\FRE\In approval process\" & NewFilePath2, ".PDF")
longstatus = swDoc.SaveAs3(NewFilePath1, 0, 0)
MsgBox("Saved " & NewFilePath1, MsgBoxStyle.Information)
End Sub
Cheers,
Fraser
SolidworksApi macros