Public Function CheckReference(StrDLL As String, StrID As String, StrRef As String) As Boolean
'StrDLL - "Scaner1C.dll"
'StrID -'Сканер'
'StrRef -"Scaner"
'обращение к функции
'(CheckReference("Scaner1C.dll", "Сканер", "Scaner")
'strPUTI = CurrentProject.Path & "\ocx_dll\Для сканера\Scaner1C.dll"
Dim ref As Reference, i As Integer
Dim strPUTI As String
CheckReference = False
On Error GoTo CheckReference_err
For Each ref In References
If ref.BuiltIn Then GoTo refNext
If ref.IsBroken Then
References.Remove ref
GoTo refNext
End If
If InStr(1, ref.Name, StrRef, vbTextCompare) > 0 Then
CheckReference = True
GoTo CheckReference_exit
End If
refNext:
Next ref
On Error Resume Next
References.AddFromFile (strPUTI)
If Err = 0 Then
CheckReference = True
GoTo CheckReference_exit
End If
Err.Clear
CheckReference_exit:
Exit Function
CheckReference_err:
MsgBox Err.Description
Resume CheckReference_exit
End Function
|