Locating and Referencing Libraries in Code : References « Application « VBA / Excel / Access / Word

Locating and Referencing Libraries in Code

Function CreateLibRef(strLibName as String)
    Dim ref As Reference
    On Error GoTo CreateLibRef_Err
    'Create new reference
    Set ref = References.AddFromFile(strLibName)
    CreateLibRef = True
    Exit Function
    Dim intAnswer As Integer
    Dim strLocation As String
    intAnswer = MsgBox("Library Not Found, Attempt to Locate?", _
        vbYesNo, "Error")
    If intAnswer = vbYes Then
       strLocation = InputBox("Please Enter the Location of the Library")
        CreateLibRef = False
        GoTo Exit_CreateLibRef
    End If

End Function


Related examples in the same category

1.Requires a reference to Microsoft InfoPath.