AnsweredAssumed Answered

Save pdf in a specific folder

Question asked by Riccardo Rebichini on Jun 20, 2017
Latest reply on Jun 20, 2017 by Bobby Penland

Hi ,

I am not expert in macro and I find on internet a macro to save in .pdf with a specific name built in this way: my code + revision + descriprion.

Now I want to save my pdf in a specific folder. I found several macro on internet but I could not find the right way to use them.

Anyone can help me to modify the following macro to reach the target?

Thank you in advance!


Option Explicit


Dim swApp               As Object

Dim Part                   As Object

Dim FilePath             As String

Dim PathSize            As Long

Dim PathNoExtention     As String

Dim NewFilePath         As String

Dim Descrizione         As String

Dim Revisione           As String

Dim Codice              As String

Dim Rev                 As String


Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc


FilePath = Part.GetPathName

PathSize = Strings.Len(FilePath)

Descrizione = Part.CustomInfo("Descrizione")

Codice = Part.CustomInfo("Codice")

Rev = Part.CustomInfo("Revisione")


PathNoExtention = Strings.Left(FilePath, PathSize - 7)


NewFilePath = Codice & "-Rev_" & Rev & "-" & Descrizione


Part.SaveAs2 NewFilePath & ".PDF", 0, True, False


End Sub