You should be prompted with the browse window. Upon completion, it should type the name of the folder you selected in the Immediate window under what you typed above. To test with a default, type the following,
'Browse for a folder, using the Excel 2002 FileDialog Sub BrowseForFolder() Dim fdBrowser As FileDialog 'Get the File Dialog object Set fdBrowser = Application.FileDialog(msoFileDialogFolderPicker) With fdBrowser 'Initialize it .Title = "Select Folder" .InitialFileName = "c:\" 'Display the di...
js选择文件夹路径该方法只支持IE.语法:strDir=Shell.BrowseForFolder(Hwnd,Title,Options,[RootFolder])参数:Hwnd:包含对话框的窗体句柄(handle),一般设置为0Title:将在对话框中显示的说明,为字符串Options:使用对话框的特殊方式,为长整数,一般设置为0RootFolde ...
VBA Code to Browse a Folder .Quite often a VBA developer requires code to browse a folder. This is mainly for saving the output file or reading the input file(s)
chooseFolder() As String ' 声明变量 Dim shell, folder ' 创建Shell对象,用来浏览系统文件夹 Set shell =CreateObject("Shell.Application") Set folder = shell.BrowseForFolder(0,"选择你要导出的目标文件夹...", 1, 0) ' 判断是否选择了文件夹 If Not folder Is Nothing Then chooseFolder = 来自coreld...
5、;= 5 And Target.Cells.Row <= 8) Then If Target.Cells.Value = "" Then Target.Cells.Value = "" Else Target.Cells.Value = "" End If Cancel = True End IfEnd Sub· 文件夹选择框方法1Set objShell = CreateObject("Shell.Application")Set objFolder = objShell.BrowseForFol 6、der(0,...
If yyy.FileExists(D: folderld.xls) = TrueThen .7,打开 folderl 中所有文件 Set rrr = CreateObject(Scripting.FileSystemObject) Set r = rrr.GetFolderfd: folderl) For Each i In r.Files Workbooks.Open Filename: =(d: folderl + i.Name + ) Next8,删除文件 c.xls killd: folderlc.xls9,...
VBA是一种通用编程语言,适用于任何内置有VBA的应用程序,因此Word VBA与Excel VBA的语法一样,只是处理...
modMain,仅包含FSBrowse()的代码。 VBA代码 让我们从一个例程开始,该例程提供一个使用此对象的简单接口。 我叫它 FSBrowse,这是一个功能过程。 Option Compare Database Option Explicit 'FSBrowse (File System Browse) allows the operator to browse for a file/folder. ...
上一期的程序 Sub FileDialog_sample1() With Application.FileDialog(msoFileDialogFolderPicker) .InitialF...