Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder("C:\New folder _1")
我正在使用此代码来读取文件夹路径。 objFolder将存储文件夹的路径。 以同样的方式,当我运行总代码时,我需要一个对话框在哪里 我应该能够进入文件夹路径。
答案 0 :(得分:0)
Browse4File的这个脚本:browse files in folder
和Browse4Folder的代码:
Option Explicit
Dim RootFolder
RootFolder = Browse4Folder
MsgBox RootFolder,VbInformation,RootFolder
'**********************************************************************************************
Function Browse4Folder()
Dim objShell,objFolder,Message
Message = "Please select a folder in order to scan into it and its subfolders"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0,Message,1,"c:\Programs")
If objFolder Is Nothing Then
Wscript.Quit
End If
Browse4Folder = objFolder.self.path
end Function
'**********************************************************************************************