AnsweredAssumed Answered

How to use a variable in the save as file path of a macro

Question asked by Josh Hixon on Jun 5, 2018
Latest reply on Jun 5, 2018 by Christian Chu

Hi, all I am still pretty fresh in the Macro writing world and hit a problem I can not seem to solve.  Our Sales team creates a folder named as a sales order number on a shared drive, we save all of our drawings as a PDF into a subfolder within that folder. My goal is to have a macro that uses a custom property that is the sales order number and puts it into the file path.  I have everything I need to do this except I can not get the variable that pulls my custom property to write as part of the file path. Here is what I tried.

 

Here is the section of Code I am referring too:

 

Set swDraw = swModel

Dim Rev As String

Dim Folder As String

 

 

Rev = swModel.CustomInfo("Revision")

Folder = swModel.CustomInfo("Sales Order")

 

 

Filepath = "C:\Users\jhixon\Desktop\%Folder%\Submittals\"

 

 

FileName = Left(swDraw.GetTitle, Len(swDraw.GetTitle) - 10)

 

 

swDraw.SaveAs (Filepath + FileName + " " + Rev + ".PDF")

 

What am I doing Wrong?

 

A lot of this code is thanks to Deepak Gupta

Outcomes