Article ID: 161030
Article Last Modified on 1/19/2007
Sub SetAssistant(ActFile as String)
On Error GoTo SetAssistant_Err
Dim fs As FileSearch
Dim accObj as Object
Dim i As Integer
' Search for the Assistant file name.
Set fs = Application.FileSearch
With fs
.LookIn = "C:\"
.SearchSubFolders = True
.FileName = ActFile
If .Execute > 0 Then
Set accObj = CreateObject("Access.Application")
With accObj
.Visible = True
.Assistant.FileName = ActFile
.Assistant.Visible = True
End With
Else
MsgBox "The Assistant file you specified was not found."
End If
End With
GoTo SetAssistant_Exit
SetAssistant_Exit:
Set fs = Nothing
Set accObj = Nothing
Exit Sub
SetAssistant_Err:
MsgBox Err.Number
Resume SetAssistant_Exit
End Sub
SetAssistant("clippit.act")
Sub Test()
On Error GoTo Err_Occurred
Dim accObj As Object
Set accObj = CreateObject("Access.Application")
accObj.Assistant.FileName = "NonExistent.act"
Exit Sub
Err_Occurred:
MsgBox "The following error occurred: " & vbcr & Err.Number
End Sub
Test
Additional query words: OLE Automation
Keywords: kbbug kberrmsg kbprogramming KB161030