PDM tree copy via VBA macro

Hi all! 

To explain the context of my "problem", I would like to use a macro to run from SolidWorks to open the PDM tree copy window (see below):

The way I have found so far would be to use the "CopyTree (IEdmVault19)" method (CopyTree Method (IEdmVault19) - 2018 - SOLIDWORKS API Help) specifying the value of "vbShowDlf" to "True" in order to display the window! 

To try to use this method, I made the following macro: 

Dim swApp As SldWorks.SldWorks
Dim vault As IEdmVault19
Dim copyTreeOptions As EdmCopyTreeOptions

Sub main()

Set vault = New EdmVault5
vault.LoginAuto "XXXXXXXX", 0

copyTreeOptions.mbsPrefix = "Copy_"
            
test = vault.CopyTree(aFile.ID, Folder.ID, destFolder, True, True, copyTreeOptions, 0)

End Sub

I haven't yet set up everything related to the ID(s) of the files you want to copy but I don't think that's the source of the problem. 

My problem is that when trying to launch this macro I get the following error message which seems to be related to the "CopyTreeOptions":

Does anyone have an example of how to use the "CopyTree (IEdmVault19)" method  so that I can use it as an example?  Where else would you have ideas to achieve what I'm trying to do? 

Thank you very much in advance!

Hello

I don't have an answer to give you but on the other hand I would be curious to know the reason for this macro and if it could be useful to us.

1 Like

The goal would be to create a macro button in SolidWorks in order to open the tree copy interface window directly and thus avoid having to go to the PDM explorer , find the file to copy, etc...  ;)  

1 Like

Ok because from SolidWorks there is a button to open the file in question in the PDM "Select from Windows Explorer".

But the macro should save a few seconds on the copy.

1 Like