Hi! I’m trying to get the value of a variable from a PDM folder datacard with a VBA macro.
From the API documentation I understand that I can cast a IEdmFolder5
object to the IEdmEnumeratorVariable5
interface. I then would like to use the GetVar
method to access the variable value.
Here is the code:
Dim pdmVault As Object
Const VAULT_NAME As String = "VAULT_BL_TEST"
Const VARIABLE_NAME As String = "_BL_DESCRIZIONE"
Const FILE_PATH As String = "C:\VAULT_BL_TEST\DISEGNI\MACCHINE\CARRELLI\A077\"
Sub main()
Set pdmVault = CreateObject("ConisioLib.EdmVault")
pdmVault.LoginAuto VAULT_NAME, 0
If pdmVault.IsLoggedIn Then
Dim folder As IEdmFolder5
Set folder = pdmVault.GetFolderFromPath(FILE_PATH)
Dim folderId As Integer
folderId = folder.ID
Dim varEnum As IEdmEnumeratorVariable5
Set varEnum = folder
Dim status As Boolean
Dim varValue As String
status = varEnum.GetVar(VARIABLE_NAME, "", varValue)
Debug.Print(" varValue : " & varValue )
Else
Err.Raise vbError, "User not connected to the Vault"
End If
End Sub
The code return varValue
as an empty string, but a True
status.
In VBE I added the reference to the PDM library:
The folder datacard is as per image below
Where am I wrong?
Thanks in advance.