2015-04-20 39 views
0
Set fso = CreateObject("Scripting.FileSystemObject") 
Set objFolder = fso.GetFolder("C:\New folder _1") 

我正在使用此代碼讀取文件夾路徑。 objFolder將存儲文件夾的路徑。 以同樣的方式,當我運行總代碼,我需要一個對話框,其中 我應該能夠進入文件夾路徑。如何創建對話框以輸入文件路徑

+0

你是不是也很新的搜索引擎? https://duckduckgo.com/?q=vbscript+dialog+folder –

+0

可能重複的[VBScript打開對話框來選擇文件路徑](http://stackoverflow.com/questions/21559775/vbscript-to-open- a-dialog-to-select-a-filepath) –

+0

您的意思是Browse4Folder或Browse4File? – Hackoo

回答

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 
'********************************************************************************************** 
相關問題