我正在创建一个脚本,使用下面的对话框来选择此运行命令问题的文件夹,它是不必作为创建新文件夹的选项...我想知道如何删除"制作新文件夹"?
我的代码:
Option Explicit
Dim strPath
strPath = SelectFolder( "" )
If strPath = vbNull Then
WScript.Echo "Cancelled"
Else
WScript.Echo "Selected Folder: """ & strPath & """"
End If
Function SelectFolder( myStartFolder )
' Standard housekeeping
Dim objFolder, objItem, objShell
' Custom error handling
On Error Resume Next
SelectFolder = vbNull
' Create a dialog object
Set objShell = CreateObject( "Shell.Application" )
Set objFolder = objShell.BrowseForFolder( 0, "Select Folder", 1, myStartFolder )
' Return the path of the selected folder
If IsObject( objfolder ) Then SelectFolder = objFolder.Self.Path
' Standard housekeeping
Set objFolder = Nothing
Set objshell = Nothing
On Error Goto 0
End Function
答案 0 :(得分:6)
如有疑问,请阅读the documentation:
BIF_NONEWFOLDERBUTTON (0x00000200)
0x00000200。版本6.0。不要在浏览对话框中包含新建文件夹按钮。
将0x200添加到options参数:
Set objFolder = objShell.BrowseForFolder(0, "Select Folder", &h201, myStartFolder)