Copy a document from EPDM and paste it to a local disk via VBA

Hello

I wish I could copy a file from PDM and paste it to a local disk outside of PDM.

Attached is the VBA code snippet that I started making, but it doesn't work. (see error message).

Is it feasible? Does anyone have any idea of the problem?

Thank you.


code_vba.png

Attached is the error message

Thank you


message_erreur.png

Hello

GetFileCopy is only used to repatriate a file locally in the vault (equivalent to getting version).

You have to use the CopyFile method.

1 Like

Thank you, indeed...

On the other hand, I'm not an expert in VBA and I can't use the CopyFile method.

see attached 


copyfile.png

The easiest way is to do a simple copy/paste windows.

Dim Vault As New EdmVault5
Dim folder As IEdmFolder5
Dim file As IEdmFile5
Dim destfolder As String

Vault.LoginAuto "BllueBus", 0

Set file = vault.GetFileFromPath("D:\BE_Produit_01\Fichiers pour export\Donnnées Publiées\PDF\U100023AA-R01.pdf")

destfoler = "C:\Temp\"

FileCopy "D:\BE_Produit_01\Fichiers pour export\Donnnées Publiées\PDF\U100023AA-R01.pdf", "C:\Temp\U100023AA-R01.pdf"

All you have to do is put variables to manage different files and use the GetFile method to get the file locally before making the copy.

1 Like

Below is a functional code.

Sub CopyFile()

Dim Vault As EdmVault5
Dim folder As IEdmFolder5
Dim file As IEdmFile5
Dim destfolder As String


Set Vault = New EdmVault5
Vault.LoginAuto "BlueBus", 0

Set folder = Vault.GetFolderFromPath("D:\BE_Produit_01\Fichiers pour export\Donnnées Publiées\PDF\")
Set file = folder.GetFile("U100023AA-R01.pdf")

file.GetFileCopy 0, "", 0

destfolder = "C:\PDF\"

FileCopy file.GetLocalPath(folder.ID), destfolder & file.Name

End Sub

 

3 Likes

Thank you Cyril.f!

it works!