I have some code I pulled from Knowledge Base that opens a file in a text field when the text field is double clicked. It works quite nicely if the file is in the proper spot. I’d like to revise the code so it looks in one folder for the file, then in a second folder if the file is not in the first folder. If it doesn’t find it in the second folder, a browse dialog should appear and allow the user to navigate to the file. Any help would be appreciated.
Thanks!!
Current setup:
Module:
Option Explicit
Declare Function ShellExecute Lib “shell32.dll” Alias _
“ShellExecuteA” (ByVal Hwnd As Long, ByVal lpOperation _
As String, ByVal lpFile As String, ByVal lpParameters _
As String, ByVal lpDirectory As String, ByVal nShowCmd _
As Long) As Long
Global Const SW_SHOWNORMAL = 1
Command:
Private Sub Voucher_DblClick(Cancel As Integer)
Dim strMyDir As String
strMyDir = “W:SHAREDDBase WorkScannedImages”
‘Application.FollowHyperlink strFileName, , True
Dim DocName As String
DocName = Me.Voucher
StartDoc = ShellExecute(Application.hWndAccessApp, “Open”, DocName, _
“”, strMyDir, SW_SHOWNORMAL)
End Sub