Hi Guys,
I'm using the module below, along with some code attached to the OnClick event of a command button to open a folder on a network drive. I'm wondering is it possible to just get the folder itself to open without the Explorer window appearing on the left of the screen ?
An example of the code on the command button would be
Module
Any help would be great
Thanks,
Em
I'm using the module below, along with some code attached to the OnClick event of a command button to open a folder on a network drive. I'm wondering is it possible to just get the folder itself to open without the Explorer window appearing on the left of the screen ?
An example of the code on the command button would be
Code:
Private Sub cmd_OpenSanit_Click()
ShellToFile "S:\Quality Systems\Sanitation", , SW_SHOWMAXIMIZED
End Sub
Module
Code:
Option Compare Database
Option Explicit
Public Const SW_HIDE = 0
Public Const SW_SHOWNORMAL = 1
Public Const SW_SHOWMINIMIZED = 2
Public Const SW_SHOWMAXIMIZED = 3
Public Const OP_OPEN = "Open"
Public Const OP_PRINT = "Print"
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 nshowcm As Long)
Sub ShellToFile(strPath As String, _
Optional strOperation As String = OP_OPEN, _
Optional lngShow As Long = SW_SHOWNORMAL)
Dim lngRetVal As Long
Dim lngHwnd As Long
lngHwnd = Application.hWndAccessApp
lngRetVal = ShellExecute(lngHwnd, strOperation, strPath, _
vbNullString, CurDir, lngShow)
If lngRetVal < 32 Then
MsgBox "Unable to open file " & strPath, vbInformation, "Warning"
End If
End Sub
Any help would be great
Thanks,
Em