I am trying to use a VBA code in access which has this subroutine that opens a dialog to select a folder. However it fails on the first line saying Runtime error 429: ActiveX component can't create object. I know this has to do with a library reference missing or something but I am unable to isolate it. I am using Access 2003 and have selected these references:
Microsoft ADO 2.8 Library
Microsoft Scripting Runtime
Microsoft Access 10.0 Object Library
OLE Automation
Visual Basic for Applications
And here is the sub
Private Function GetPathToUse() As Variant
'Get the folder containing the files
'Note uses the "Copy Dialog" which enables the "open" option
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
GetPathToUse = .Directory
Else
GetPathToUse = ""
Exit Function
End If
End With
If Left(GetPathToUse, 1) = Chr(34) Then
GetPathToUse = Mid(GetPathToUse, 2, Len(GetPathToUse) - 2)
End If
End Function
Help appreciated
Microsoft ADO 2.8 Library
Microsoft Scripting Runtime
Microsoft Access 10.0 Object Library
OLE Automation
Visual Basic for Applications
And here is the sub
Private Function GetPathToUse() As Variant
'Get the folder containing the files
'Note uses the "Copy Dialog" which enables the "open" option
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
GetPathToUse = .Directory
Else
GetPathToUse = ""
Exit Function
End If
End With
If Left(GetPathToUse, 1) = Chr(34) Then
GetPathToUse = Mid(GetPathToUse, 2, Len(GetPathToUse) - 2)
End If
End Function
Help appreciated