Brett Casteel

VBA macro to Save as in PDM folder

Discussion created by Brett Casteel on Oct 30, 2019

I have made several VBA macros that save files to various server locations and they all work fine but recently I was tasked with making a macro that would save a file to a PDM folder that the user might not have loaded into their local cashe.

 

If i just tell solidworks to save it will fail and not save unless the user opens the folder first. So i have made a workaround using: Shell "C:\WINDOWS\explorer.exe """ & PathFull & "", vbNormalNoFocus followed by a wait loop then i run a Part.SaveAs3 but the method just seems clunky and if the user runs several instances of the macro they then have a bunch of windows to close.

 

I thought running something like this would do it but it didn't help vault.GetFolderFromPath (PathFull)

 

does anyone know a good way to pull an empty folder into a users cashe without running a shell open? or does solidworks have another method of saving when going to a PDM location?

Outcomes