wings91
Mechanical
- Nov 12, 2010
- 1
Let it be known that I am no good at macros or VB whatsoever.
I am trying to get a macro that allow me to bypass the document level printer settings and print to the printer I setup inside the macro.
I found this thread:
but I was unable to understand the setup.
I currently use this macro, but regardless of what printer I put in the SWPrinter field, it will print to the printer saved in the document level:
Dim swApp As Object
Dim Part As Object
Dim DrawingDoc As Object
Dim SWPrinter As String
Dim SWOrientation As Long
Dim Fit As Boolean
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
SWPrinter = "\\Rytec-1\Engineering"
SWOrientation = swPageSetupOrient_Landscape
Fit = True
Part.Printer = SWPrinter
Part.PageSetup.Orientation = SWOrientation
Part.PageSetup.ScaleToFit = Fit
Part.PrintDirect
End Sub
My goal:
1) Override the document level printer setting and print to the printer saved inside the macro.
2) Print only on A-size paper
3) Always print to fit
Any help is greatly appreciated.
Thanks!
DAVE
I am trying to get a macro that allow me to bypass the document level printer settings and print to the printer I setup inside the macro.
I found this thread:
but I was unable to understand the setup.
I currently use this macro, but regardless of what printer I put in the SWPrinter field, it will print to the printer saved in the document level:
Dim swApp As Object
Dim Part As Object
Dim DrawingDoc As Object
Dim SWPrinter As String
Dim SWOrientation As Long
Dim Fit As Boolean
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
SWPrinter = "\\Rytec-1\Engineering"
SWOrientation = swPageSetupOrient_Landscape
Fit = True
Part.Printer = SWPrinter
Part.PageSetup.Orientation = SWOrientation
Part.PageSetup.ScaleToFit = Fit
Part.PrintDirect
End Sub
My goal:
1) Override the document level printer setting and print to the printer saved inside the macro.
2) Print only on A-size paper
3) Always print to fit
Any help is greatly appreciated.
Thanks!
DAVE