Hi all
I need your help again.
I want to retrieve a variable from a pdm file (variable called "_Description" via an excel macro. Here is my snippet of code, I don't get anything.
I think the error comes from loading the configs at the enumvar level.
On Error Resume Next
Dim strWorkbookPath As String
strWorkbookPath = ThisWorkbook.FullName
Dim oVault As New EdmVault5
oVault.LoginAuto oVault.GetVaultNameFromPath(strWorkbookPath), 0
Dim oFile As IEdmFile6
Dim oFolder As IEdmFolder6
Set oFile = oVault.GetFileFromPath(strWorkbookPath, oFolder)
Dim projName As String
If oFile Is Nothing Then
MsgBox "File not in EPDM vault", vbCritical
Else
Dim Worksheet As Worksheet
Worksheet = ThisWorkbook.ActiveSheet
Dim oRef As IEdmReference5
Set oRef = oFile.GetReferenceTree(oFolder.ID, 0)
Dim msg As String
Dim pos As IEdmPos5
Set pos = oRef.GetFirstChildPosition(projName, True, True, 0)
Dim ref As IEdmReference5
Sun xx As String
Dim row As Integer
row = 7
'Retrieving variables
Dim enumVar As IEdmEnumeratorVariable5
Dim oVal As Variant
Dim bGetVar as Boolean
'Configurations'
Dim cfgList As EdmStrLst5
Dim cfgName As String
Dim pos2 As IEdmPos5
While Not pos. IsNull
Set ref = oRef.GetNextChild(pos)
'Configuration
Set cfgList = ref. File.GetConfigurations
Set pos2 = cfgList.GetHeadPosition
cfgName = cfgList.GetNext(pos2)
'Variables'
Set enumVar = ref. File.GetEnumeratorVariable
'Revision
enumVar.GetVar "_Révision", cfgName, oVal
ActiveSheet.Cells(row, 4). Value2 = oVal
'Description
bGetVar = enumVar.GetVar("Description", cfgName, oVal)
ActiveSheet.Cells(row, 6). Value2 = oVal
'Next line
row = row + 1
Wend