View Folder (Like If you've clicked on it via Windows)
Launch Folder Window (Like If you've clicked on it via Windows)
This code will launch the Window of specific Folder. For example,
launching the "c:\" folder will be exactly as if you were double clicking
on "My Computer".
Module Code
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_SHOWNORMAL = 1
Form Code
Public Sub OpenDirectory(Directory As String)
ShellExecute 0, "Open", Directory, vbNullString, _
vbNullString, SW_SHOWNORMAL
End Sub
Private Sub Form_Load()
' Replace the "C:\" below with the folder you want to view
OpenDirectory ("C:\")
End Sub
|