明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3981|回复: 2

[讨论] 关于vba的BrowseForFolder参数设定

[复制链接]
发表于 2011-4-26 13:51:36 | 显示全部楼层 |阅读模式
strDir = Shell.BrowseForFolder(Hwnd, Title,Options, [RootFolder])
其中RootFolder(可选的),用来设置浏览的最顶层文件夹,缺省时为桌面

那么,弹出对话框后如果我想设定一个默认目录,同时又能浏览到桌面或者别的盘的目录,那么语句应该怎么写啊,(因为它有一个问题就是一旦设定了[RootFolder],即被认为是最顶层
发表于 2011-4-26 14:40:28 | 显示全部楼层
本帖最后由 highflybird 于 2011-4-26 14:47 编辑

http://msdn.microsoft.com/en-us/library/bb774065(VS.85).aspx
vRootFolder [in, optional]Type: Variant
The root folder to use in the dialog box. The user cannot browse higher in the tree than this folder. If this value is not specified, the root folder used in the dialog box is the desktop. This value can be a string that specifies the path of the folder or one of the ShellSpecialFolderConstants values. Note that the constant names found in ShellSpecialFolderConstants are available in Visual Basic, but not in VBScript or JScript. In those cases, the numeric values must be used in their place.

翻译过来,就是:
这个可选参数用于设置根目录(浏览目录的起点)。用户不能浏览比这个目录更高层的目录。如果这个参数没有指定,那么,这个根目录设置为桌面。.....
所以,依据我理解你的意思是:你想两全其美,用Shell.BrowseForFolder 似乎不行。
建议你用通用文件对话框。
发表于 2013-1-19 14:04:35 | 显示全部楼层
可惜我的VB忘的一干二次,这是我搜出来资料
http://metrom.blog.163.com/blog/static/20298163201112783933225/
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-6-1 23:52 , Processed in 0.169630 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表