本帖最后由 yu2n 于 2014-5-10 17:23 编辑
取 inputbox 的返回值就行了也可以用文件选择框:
CrLf 发表于 2014-5-9 23:44
选择文件夹位置:- Dim strPath
- strPath=BrowseForFolder("请选择一个文件夹:")
- Msgbox strPath
复制代码
- ' +----------------------------------------------------------------------------+
- ' | 浏览文件夹 ' File:Dialog.vbs (WSH sample in VBScript) |
- ' | Author:(c) G. Born |
- ' +----------------------------------------------------------------------------+
- Function BrowseForFolder(ByVal sTips)
- Const BIF_returnonlyfsdirs = &H0001
- Const BIF_editbox= &H0010
- Dim oShell, oFolder
- BrowseForFolder = ""
- Set oShell = CreateObject("Shell.Application")
- Set oFolder = oShell.BrowseForFolder(&H0, sTips, BIF_editbox + BIF_returnonlyfsdirs)
- If InStr(1, TypeName(oFolder), "Folder") > 0 Then
- BrowseForFolder = oFolder.Items().Item().Path
- End If
- End Function
复制代码
|