Я однажды нашел это где-то в сети, не могу вспомнить где.Я поместил его в свой собственный модуль и использовал, вызывая OpenFile
, передавая полный путь к файлу в качестве параметра.
Здесь:
Option Compare Database
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
Public Function OpenFile(sFileName As String)
On Error GoTo Err_OpenFile
OpenFile = ShellExecute(Application.hWndAccessApp, "Open", sFileName, "", "C:\", 1)
Exit_OpenFile:
Exit Function
Err_OpenFile:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_OpenFile
End Function
Этот модуль поставляется с тестом.Вы можете запустить его:
Public Function TestOpeningFile()
On Error GoTo Err_TestOpeningFile
OpenFile "C:\Windows\Win.ini"' Replace this line with any file
Exit_TestOpeningFile:
Exit Function
Err_TestOpeningFile:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_TestOpeningFile
End Function