1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
Dim Tableau() As String
Dim Tableau1(7, 1) As String
Dim m As Integer
Dim ref, msg$
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim TC() As String
Dim pareil As Boolean
Tableau1(0, 0) = "Visual Basic For Applications"
Tableau1(1, 0) = "Microsoft Excel 16.0 Object Library"
Tableau1(2, 0) = "OLE Automation"
Tableau1(3, 0) = "Microsoft Office 16.0 Object Library"
Tableau1(4, 0) = "Microsoft Forms 2.0 Object Library"
Tableau1(5, 0) = "Microsoft Scripting Runtime"
Tableau1(6, 0) = "Ref Edit Control"
Tableau1(7, 0) = "Microsoft Outlook 16.0 Object Library"
Tableau1(0, 1) = "C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA7.1\VBE7.DLL"
Tableau1(1, 1) = "C:\Program Files (x86)\Microsoft Office\Root\Office16\EXCEL.EXE"
Tableau1(2, 1) = "C:\Windows\SysWOW64\stdole2.tlb"
Tableau1(3, 1) = "C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE16\MSO.DLL"
Tableau1(4, 1) = "C:\WINDOWS\SysWOW64\FM20.DLL"
Tableau1(5, 1) = "C:\Windows\SysWOW64\scrrun.dll"
Tableau1(6, 1) = "C:\Program Files (x86)\Microsoft Office\Root\Office16\REFEDIT.DLL"
Tableau1(7, 1) = "C:\Program Files (x86)\Microsoft Office\Root\Office16\MSOUTL.OLB"
msg = ""
For Each ref In ActiveWorkbook.VBProject.References
ReDim Preserve Tableau(0 To m)
'msg = msg & ref.Name & vbCr
msg = msg & ref.Description & vbCr
msg = msg & ref.FullPath & vbCr & vbCr
Tableau(m) = ref.Description
m = m + 1
Next ref
k = 0
For j = 0 To UBound(Tableau1)
For i = 0 To UBound(Tableau)
If Tableau(i) = Tableau1(j, 0) Then
pareil = True
Exit For
Else
pareil = False
End If
Next
'If pareil = False Then
'ReDim Preserve TC(0 To k)
'TC(k) = Tableau1(j, 0)
'k = k + 1
'End If
Next
If j <> m Then
ThisWorkbook.VBProject.References.AddFromFile Tableau1(i, 1) ' ajoute la reference manquante <== Ligne posant problème
End If
MsgBox msg, , " Reference for: " & ActiveWorkbook.Name
Debug.Print msg |
Partager