Jonas Drejer Nielsen

Save PDF to specific location and OVERWRITE old PDF

Discussion created by Jonas Drejer Nielsen on Mar 6, 2020
Latest reply on Mar 10, 2020 by Jonas Drejer Nielsen

Hi All,


I have found and copied a macro from this forum for saving a drawing as a PDF in a specific sharepoint folder, and it works as it should so far. (see attachment)


But I have a problem. The folder i'm saving it to is located on my company's sharepoint drive, so the PDF files is accessible online for all the employees, both with and without access to SW, PDM etc.. When the files are saved/uploaded to the folder, they are in a "minor" state, so we are running a workflow where a engineer is "checking" and approving the file, and releasing it to the "major" file state. In that way, we can track the history of the file directly in our sharepoint folder. The problem is: When i'm saving a PDF file that already exists in the sharepoint folder (let's say that I have made a new revision of a drawing, and want to update the PDF in my sharepoint folder) the macro that i am using is deleting the old PDF, with the same name, before it is saving the new version. The problem is that my file history in sharepoint is reset when the old file is being deleted. The same thing is happening when i'm doing the "save as PDF" manually.


Does any of you have a trick to save AND overwrite a PDF file directly from solidworks, instead of the "Delete-old-file-create-new-file"-way that i am using now?


It would be okay to print as PDF instead, but i am not that good at VBA programming yet, so I am hoping that you are able to help me out.