Option Compare Database
Option Explicit
Public 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 Const SW_SHOWMAXIMIZED = 3
Public Const SW_SHOWDEFAULT = 10
Public Const SW_SHOWNOACTIVATE = 4
Public Const SW_SHOWNORMAL = 1
Function OpenFile(strNameFile As String)
Dim intResult As Integer
intResult = ShellExecute(Application.hWndAccessApp, "open", strNameFile, 0, 0, SW_SHOWNORMAL)
If intResult = 31 Then
If (7 = MsgBox("Ошибка!" & vbNewLine & "Тип файла незарегестрирован.", 16, "Ошибка")) Then
End If
End If
End Function
' вызов Call OpenFile("C:\2.accdb")
|