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 63
|
Function ReferencePresente(s As String) As Boolean
Dim Ref As Reference
ReferencePresente = False
For Each Ref In References
If Ref.Name = s Then ReferencePresente = True: Exit For
Next Ref
End Function
Function CreationReference(s As String) As Boolean
Dim v As String, Ref As Reference, v2 As String
On Error GoTo erreur
v = SysCmd(acSysCmdAccessVer)
v2 = "C:\Program Files\Fichiers communs\Microsoft Shared\"
Select Case v
Case "9.0" 'access 2000
Select Case s
Case "DAO"
If Dir(v2 & "dao\dao360.dll") <> "" Then Set Ref = References.AddFromFile(v2 & "dao\dao360.dll")
Case "MSACAL"
If Dir(v & "mscal.ocx") <> "" Then Set Ref = References.AddFromFile(v2 & "dao\dao360.dll")
End Select
Case "11.0" 'access 2003
Select Case s
Case "DAO"
If Dir(v2 & "dao\dao360.dll") <> "" Then Set Ref = References.AddFromFile(v2 & "dao\dao360.dll")
Case "Office"
If Dir(v2 & "Office11\mso.dll") <> "" Then Set Ref = References.AddFromFile(v2 & "Office11\mso.dll")
Case "ACTIVEXLib"
If Dir(v & "AUTHZAX.dll") <> "" Then Set Ref = References.AddFromFile(v & "AUTHZAX.dll")
Case "VBIDE"
If Dir(v2 & "VBA\VBA6\VBE6EXT.olb") <> "" Then Set Ref = References.AddFromFile(v2 & "VBA\VBA6\VBE6EXT.olb")
End Select
End Select
Exit Function
erreur:
End Function
Sub VerificationReferences()
Dim v As String, Ref As Reference, i As Long
On Error GoTo erreur
v = SysCmd(acSysCmdAccessVer)
Select Case v
Case "9.0"
If Not ReferencePresente("DAO") Then Call CreationReference("DAO")
If Not ReferencePresente("MSACAL") Then Call CreationReference("MSACAL")
Case "11.0"
If Not ReferencePresente("DAO") Then Call CreationReference("DAO")
If Not ReferencePresente("Office") Then Call CreationReference("Office")
If Not ReferencePresente("ACTIVEXLib") Then Call CreationReference("ACTIVEXLib")
If Not ReferencePresente("VBIDE") Then Call CreationReference("VBIDE")
End Select
Exit Sub
erreur:
Resume Next
End Sub |
Partager