Public Function CheckReferenceDAO() As Boolean
'-------------------------------------------------------------------------------
On Error GoTo CheckReferenceDAO_Error
'-------------------------------------------------------------------------------
CheckReferenceDAO = False
Dim ref As Reference, i As Integer
Const strDAOGUID = "{00025E01-0000-0000-C000-000000000046}"
'Const strExcelReferenceName = "*DAO*"
For Each ref In References
If ref.BuiltIn Then GoTo refNext
If ref.IsBroken Then
References.Remove ref
GoTo refNext
End If
' If ref.Name Like strExcelReferenceName Then
If InStr(1, ref.NAME, "DAO", vbTextCompare) > 0 Then
CheckReferenceDAO = True
Exit Function
End If
refNext:
Next ref
On Error Resume Next
For i = 5 To 2 Step -1
References.AddFromGuid strDAOGUID, 1, i
If Err = 0 Then
CheckReferenceDAO = True
Exit Function
End If
Err.Clear
Next i
'-------------------------------------------------------------------------------
On Error GoTo 0
Exit Function
CheckReferenceDAO_Error:
Call Zapis_ERR("ssilki" & "ïðîöåäóðà->" & "CheckReferenceDAO", Err.Number, Err.Description)
End Function
|