Private Sub Command1_Click()
With cd
.Flags = &H200&
.ShowOpen
MsgBox .FileName
End With
End SubConstant Value Description
cdlOFNAllowMultiselect &H200 Specifies that the File Namelist box allows multiple selections.
The user can select more than one file atrun time by pressing the SHIFT key and using the UP ARROW and DOWN ARROW keys to select the desired files. When this is done, the FileName property returns a string containing the names of all selected files. The names in the string are delimited by spaces.
cdlOFNCreatePrompt &H2000 Specifies that the dialog box prompts the user to create a file that doesn't currently exist. This flag automatically sets the cdlOFNPathMustExist and cdlOFNFileMustExist flags.
cdlOFNExplorer &H80000 Use the Explorer-like Open A File dialog box template. Works with Windows 95, Windows NT 4.0, or later versions.
CdlOFNExtensionDifferent &H400 Indicates that the extension of the returned filename is different from the extension specified by the DefaultExt property. This flag isn't set if the DefaultExt property is Null, if the extensions match, or if the file has no extension. This flag value can be checked upon closing the dialog box.
cdlOFNFileMustExist &H1000 Specifies that the user can enter only names of existing files in the File Name text box. If this flag is set and the user enters an invalid filename, a warning is displayed. This flag automatically sets the cdlOFNPathMustExist flag.
cdlOFNHelpButton &H10 Causes the dialog box to display the Help button.
cdlOFNHideReadOnly &H4 Hides the Read Onlycheck box.
cdlOFNLongNames &H200000 Use long filenames.
cdlOFNNoChangeDir &H8 Forces the dialog box to set the current directory to what it was when the dialog box was opened.
CdlOFNNoDereferenceLinks &H100000 Do not dereference shell links (also known as shortcuts). By default, choosing a shell link causes it to be dereferenced by the shell.
cdlOFNNoLongNames &H40000 No long file names.
CdlOFNNoReadOnlyReturn &H8000 Specifies that the returned file won't have the Read Only attribute set and won't be in a write-protected directory.
cdlOFNNoValidate &H100 Specifies that the common dialog box allows invalid characters in the returned filename.
cdlOFNOverwritePrompt &H2 Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file.
cdlOFNPathMustExist &H800 Specifies that the user can enter only valid paths. If this flag is set and the user enters an invalid path, a warning message is displayed.
cdlOFNReadOnly &H1 Causes the Read Only check box to be initially checked when the dialog box is created. This flag also indicates the state of the Read Only check box when the dialog box is closed.
cdlOFNShareAware &H4000 Specifies that sharing violation errors will be ignored.
With cd
.Flags = &H200&
.ShowOpen
MsgBox .FileName
End With
End SubConstant Value Description
cdlOFNAllowMultiselect &H200 Specifies that the File Namelist box allows multiple selections.
The user can select more than one file atrun time by pressing the SHIFT key and using the UP ARROW and DOWN ARROW keys to select the desired files. When this is done, the FileName property returns a string containing the names of all selected files. The names in the string are delimited by spaces.
cdlOFNCreatePrompt &H2000 Specifies that the dialog box prompts the user to create a file that doesn't currently exist. This flag automatically sets the cdlOFNPathMustExist and cdlOFNFileMustExist flags.
cdlOFNExplorer &H80000 Use the Explorer-like Open A File dialog box template. Works with Windows 95, Windows NT 4.0, or later versions.
CdlOFNExtensionDifferent &H400 Indicates that the extension of the returned filename is different from the extension specified by the DefaultExt property. This flag isn't set if the DefaultExt property is Null, if the extensions match, or if the file has no extension. This flag value can be checked upon closing the dialog box.
cdlOFNFileMustExist &H1000 Specifies that the user can enter only names of existing files in the File Name text box. If this flag is set and the user enters an invalid filename, a warning is displayed. This flag automatically sets the cdlOFNPathMustExist flag.
cdlOFNHelpButton &H10 Causes the dialog box to display the Help button.
cdlOFNHideReadOnly &H4 Hides the Read Onlycheck box.
cdlOFNLongNames &H200000 Use long filenames.
cdlOFNNoChangeDir &H8 Forces the dialog box to set the current directory to what it was when the dialog box was opened.
CdlOFNNoDereferenceLinks &H100000 Do not dereference shell links (also known as shortcuts). By default, choosing a shell link causes it to be dereferenced by the shell.
cdlOFNNoLongNames &H40000 No long file names.
CdlOFNNoReadOnlyReturn &H8000 Specifies that the returned file won't have the Read Only attribute set and won't be in a write-protected directory.
cdlOFNNoValidate &H100 Specifies that the common dialog box allows invalid characters in the returned filename.
cdlOFNOverwritePrompt &H2 Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file.
cdlOFNPathMustExist &H800 Specifies that the user can enter only valid paths. If this flag is set and the user enters an invalid path, a warning message is displayed.
cdlOFNReadOnly &H1 Causes the Read Only check box to be initially checked when the dialog box is created. This flag also indicates the state of the Read Only check box when the dialog box is closed.
cdlOFNShareAware &H4000 Specifies that sharing violation errors will be ignored.
解决方案 »
- VB6程序在WIN8下的测试
- 关于连接ftp的问题,在线等
- 用vb能否实现多功能键盘
- 小弟请教数据库连接问题,各位达人帮忙啊
- 为什么我用Winsock在Internet上面传数据,500K的东西传到36K就停止了?
- 【问】如何写 区分大小写包含查询 的SELECT语句?
- 菜鸟问题:《对象变量或with块变量未设置》是什么原因?请教with语法
- 急!请问如何在VB中实现十六制至十进制的转换?-有正确解答者决不吝分!
- 小问题,怎么在VB里调用其他的DLL文件,请说详细一点,举个例子,谢谢!!!
- 求助! timer控件的用法
- 散分:我是做asp的,我想学vb,请大家提供比较适合我的学习书籍或示例程序等的链接。
- 急!!!!数据类型转化问题!!!!!!!!!!!!!!
它指定文件名列表框允许多重选择。
操作后,FileName 属性就返回一个包含全部所选文件名的字符串。串中各文件名用空格隔开。
GetOpenFileName具体参考msdn