Public Sub RefFolder_1()
Dim WSH As Object
Dim ObjPath As Object
Dim strGuide As String
Dim FolderPath As String
strGuide = "フォルダを選択してください。"
Set WSH = CreateObject("Shell.Application")
Set ObjPath = WSH.BrowseForFolder(0, strGuide, 0)
If Not ObjPath Is Nothing Then
On Error GoTo ERR_JUMP
FolderPath = ObjPath.items.Item.Path
On Error GoTo 0
MsgBox FolderPath
Else
MsgBox "キャンセルされました。"
End If
Exit Sub
ERR_JUMP:
Err.Clear
FolderPath = CreateObject("Wscript.shell").SpecialFolders("Desktop")
MsgBox FolderPath
End Sub
|