Hi,
I have copied bits of code here and there but I lack some basic knowledge of VBA to figure this out... I have several macros to save as PDF, STEP, etc. while changing the file name and creating a folder. The new file and folder names are based on custom properties.
When I edit the macro and debug it, I have correct values for the file name and the folder names. It just that it fails to create them.
For example:
The file gets this name: "FILENAME_REV-XX_YYYY-MM-DD.PDF"
with this line: newName = Strings.Replace(fileName, ".SLDDRW", Separator & Revision & Separator & dateString & ".PDF", , , vbTextCompare)
The folder gets this name: "current_file_path\TRANSFERT\YYYY-MM-DD_SUPPLIER\"
with this line: newPath = Left(swModel.GetPathName, InStrRev(swModel.GetPathName, "\")) + "TRANSFERT\" + newSubFolderName + "\"
-I'd like to remove one folder level from the path (so the new folder is at the same level as the current one)
-The debugger stops and highlights this:
MkDir newPath
With the message "Path/File access error"
The value of newPath is :
newPath : "C:\Users\username\Documents\Travail\Projets\Nom du projet\CAD\TRANSFERT\YYYY-MM-DD_SUPPLIER\"
I join the whole script too.
Ce message a été modifié par : Marc GibeaultEdited style for clarity
SolidworksApi/macros