Jika Anda ingin menggunakan metode Late Binding maka gantilah kode berikut:
Dim Sh as new Shell32.Shell
Dim Folder As Shell32.Folder
Menjadi:
Dim Sh as Object
Dim Folder
Set Sh = CreateObject("Shell.Application")
Function BrowseForFolder(Title As String, Optional RootFolder = "") As String
On Error Resume Next
Dim sh As New Shell32.Shell
Dim Folder As Shell32.Folder
Set Folder = sh.BrowseForFolder(Me.hwnd, "Open", 1, RootFolder)
SelectFolder = Folder.Items.Item.Path
set sh = nothing
set Folder = nothing
End Function
'Berikut contoh penggunaan Fungsi Untuk Menampilkan BrowseForFolder
Private Sub Command1_Click()
'jika ingin mengeksplore "c:\" saja
MsgBox SelectFolder("Open Folder", "c:\")
'Jika ingin mengeksplore directory keseluruhan
MsgBox SelectFolder("Open Folder")
End Sub