AnsweredAssumed Answered

get current sheet as PDF

Question asked by Franz Dahinden on Nov 27, 2015
Latest reply on Nov 28, 2015 by Franz Dahinden

someone know how to change it. I like to get only current sheet. when use the macro. Thanks a lot.

 

Sub main()

Dim swApp           As SldWorks.SldWorks
Dim swModel         As SldWorks.ModelDoc2
Dim swDrawModel     As SldWorks.ModelDoc2
Dim swDraw          As SldWorks.DrawingDoc
Dim swView          As SldWorks.View
Dim nErrors         As Long
Dim nWarnings       As Long
Dim Revision As String

Set swApp = Application.SldWorks
Set swDrawModel = swApp.ActiveDoc

If swDrawModel Is Nothing Then
        MsgBox "There is no active drawing document"
        Exit Sub
End If
   
If swDrawModel.GetType <> swDocDRAWING Then
        MsgBox "Open a drawing first and then TRY again!"
        Exit Sub
End If

Set swDraw = swDrawModel

Set swView = swDraw.GetFirstView
Set swView = swView.GetNextView
Set swModel = swView.ReferencedDocument

If swModel.GetPathName = "" Then
        MsgBox "Insert a View first and then TRY again!"
        Exit Sub
End If

Index = swModel.GetCustomInfoValue("", "Index") ' Change Revision property name here if different

If Index = "" Then

        Index = ""

Else

    Index = "_(" & Index & ")"

End If

swDraw.SaveAs3 Left(swDraw.GetPathName, InStrRev(swDraw.GetPathName, ".") - 1) & Prop & Index & ".PDF", 0, 0

End Sub

Outcomes