AnsweredAssumed Answered

Generating .PDF and .DWG with macros

Question asked by Rasmus Hansen on Mar 18, 2013
Latest reply on Mar 12, 2019 by Bart Kolkman

Hi everybody

 

I work at a company in a transition between two programs. At the moment we are generating every .PDF and .DWG manually. To make this easier i started making a macro to make the process faster and automated. Problem is that i am stuck.

 

Dim swApp As Object

 

 

Dim Part As Object

Dim boolstatus As Boolean

Dim longstatus As Long, longwarnings As Long

 

 

Sub main()

 

 

Set swApp = _

Application.SldWorks

 

 

Set Part = swApp.ActiveDoc

Part.ClearSelection2 True

longstatus = Part.SaveAs3("O:\Solidworks Dokument Arkiv\Filer 2013\PDF\1099815734.PDF", 0, 0)

Part.ViewZoomtofit2

Part.ViewZoomtofit2

Part.ViewZoomtofit2

End Sub

 

This is as far i can get on my own. This macro generates a pdf from my drawing. Trouble is that it allways names the pdf the same as the part i recorded the macro from.

 

longstatus = Part.SaveAs3("O:\Solidworks Dokument Arkiv\Filer 2013\PDF\1099815734.PDF", 0, 0)

 

In my head the above line is the only thing that needs changing. I need it to get the filename from the part on the sheet instead of the recorded number.

 

I really hope there is someone out there who can offer me a hand.

 

Regards

 

Rasmus Hansen

Carsoe A/S

Mechanical Engineer

Attachments

Outcomes