Disable “Make new folder” in Select Folder Dialog

冷暖自知 提交于 2020-02-07 07:47:50

问题


I'm making a script that uses the dialog box below to select the folder where this run commands the problem is that it is not necessary as an option to create a new folder ... I wonder how can I remove the "make new folder"?

My Code:

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

回答1:


When in doubt, read the documentation:

BIF_NONEWFOLDERBUTTON (0x00000200)

0x00000200. Version 6.0. Do not include the New Folder button in the browse dialog box.

Add 0x200 to the options parameter:

Set objFolder = objShell.BrowseForFolder(0, "Select Folder", &h201, myStartFolder)


来源:https://stackoverflow.com/questions/30326611/disable-make-new-folder-in-select-folder-dialog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!