Bonjour à tous,
J'ai une nouvelle fois besoin de votre aide.
Je souhaite récupérer une variable d'un fichier pdm (variable qui s'appelle "_Description" via une macro excel. Voici mon bout de code je ne récupère rien.
Je pense que l'erreur vient du chargement des configs au niveau de enumvar.
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 "Fichier absent du coffre EPDM", 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
Dim xx As String
Dim row As Integer
row = 7
'Récupération des 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
'Ligne suivante
row = row + 1
Wend