VBA/Excel/Access/Word/Application/References — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 12:46, 26 мая 2010

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_CreateLibRef:
    Exit Function
CreateLibRef_Err:
    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")
       Resume
    Else
        CreateLibRef = False
        GoTo Exit_CreateLibRef
    End If
End Function



Requires a reference to Microsoft InfoPath.

 
Private Sub cmdRegisterForm_Click()
    Dim ap As New InfoPath.ExternalApplication
    ap.RegisterSolution ThisWorkbook.Path & "\manifest.xsf"
    ap.Quit
    Set ap = Nothing
End Sub