Macro to save a Drawing as pdf in a particular folder

Hello,

i would like to save a drawing as pdf in a folder where the path for the Folder is linked to the name of the file.

For example. the Filename is E853028569 then it should be pasted in C:\\dhf-pdf\\853\\02\\Filename.pdf

Can someone tell me how i could write a code for such a logic or provide me a code.

Thanks in advance.

SolidworksApi macros
Answers 3
DG
DG 2017-11-02 Best Answer

There many such macros on this forum, search and you should be able to find one.

AB
AB 2017-11-02
<p><span style="font-family: inherit;">The Filename is E853028569 then it should be pasted in C:\dhf-pdf\853\02\Filename.pdf</span></p>

You'll want to manipulate the string of the file name. Search through the forums or even on google for VBA string manipulation (substring, left, right, mid, split, etc.). From there, you can create the directory from the VBA code to get the folder structure you're looking for. I've done all of this in c# (System.IO.Directory.CreateDirectory) but I don't know about the VBA syntax of the same functions.

DG
DG 2017-11-02

MkDir to create a directory in VBA