How to open a drawing from SolidWorks PDM with VBA?

I have a macro that prints all drawings from assembly components if they have one. Sometimes it doesn't find a drawing from a local workstation even if I know that there should be one. So my idea is to load drawings from vault and then process these. But don't have experience from SolidWorks PDM. Can anybody show me a way? I have a drawing name and a location but how to connect vault and get a file to a local station from there?

SolidworksApi macros
Answers 2
US
US 2018-01-19 Best Answer

Hi Tapani

​ To get the files from the vault, change the part where the files are deleted.

If Not (file5 Is Nothing) Then

     'your code here, have a look at IEdmFile5.GetFileCopy()

Else

     'your error handling

End If

BiI SAP-PDM

TS
TS 2018-01-25

Thank you Ulf!

Now I have a connection to our PDM system and can get a file with a line:

Set file5 = vault5.GetFileFromPath(activeDoc, folder5)

The problem is now how to use IEdmFile5.GetFileCopy()

Any example about that somewere? Need VBA example. From help red that should have a parent window handle. Where I can get that and how to get a document loaded from PDM to a local workstation?

-----------

Found it here: