Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

PRINT TO PDF MACRO QUESTION?

Status
Not open for further replies.

Dtown266

Nuclear
Joined
Oct 31, 2006
Messages
47
Location
US
I created a macro that will print to pdf. How do you stop the adobe distiller from asking for a save location or how do you automatically fill out the save location dialog box?

thanks in advance
 
Hard to say without seeing your code. Can you post it?
 
Heres is the code. I am also having trouble setting the page size. For 34 x 22


Option Explicit
Dim swApp As SldWorks.SldWorks
Dim Model As ModelDoc2
Dim stDprinter As String
Sub main()

Set swApp = CreateObject("SldWorks.Application")
Set Model = swApp.ActiveDoc

Dim ps As PageSetup

Set ps = Model.PageSetup

ps.Orientation = 2 ' 1=Portrait '2 = Landscape



ps.PrinterPaperLength = 34 / 0.01
ps.PrinterPaperWidth = 22 / 0.01
ps.ScaleToFit = True


stDprinter = "Adobe PDF"


Dim pageArray(0) As Long

pageArray(0) = 0



Dim vPageArray As Variant

vPageArray = pageArray



Dim copies As Long

copies = 1

Dim collate As Boolean

collate = True



' Print to default printer

Model.Extension.PrintOut2 vPageArray, copies, collate, "stdprinter", ""

End Sub
 
It looks like you are using a printer-emulating Adobe distiller. SolidWorks thinks you are printing to a printer. Therefore, you can't pass a filename to the distiller. If you want the macro to specify the filename you will need to look into doing a "Save As" PDF. If you'll do a Google search of this forum/the web I'm sure you can find some examples of how to do this.
 
THAT STINKS. What about the paper size how would i go about specifing 34 x 22.

 
never mind i figured it out thanks for all the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top