Save Table to PDF Example (VBA)
This example shows how to save a table as a PDF file.
'-----------------------------------------------------------------
' Preconditions:
' 1. Open a part document that contains a table annotation.
' 2. Select the table annotation.
' 3. Run the macro.
'
' Postconditions: The selected table is saved as c:\table.pdf.
'-----------------------------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelectionMgr As SldWorks.SelectionMgr
Dim swTableAnnotation As SldWorks.TableAnnotation
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelectionMgr = swModel.SelectionManager
'Get the selected table and save as a PDF file
Set swTableAnnotation = swSelectionMgr.GetSelectedObject6(1, 0)
swTableAnnotation.SaveAsPDF ("c:\table.pdf")
End Sub