不用组件的话有两种办法:
set objFile = CreateObject("SAFRCFileDlg.FileOpen")
Set objShell = CreateObject("Shell.Application")
本blog里都有示例。
如果调用vb组件,可以是:
flag = &h200
whichone = OpenFile("Choose a File!", "C:\", "Everything|*.*|TextFiles|*.TXT|Word-Documents|*.DOC", 2, flag)
MsgBox "Raw data returned: " & whichone
' Split up multi selection result:
' space is used as separator:
whichone = Split(whichone, " ")
' field index 0 contains path information:
path = whichone(0)
' list all the files:
' how many files were selected?
filecount = UBound(whichone)
if filecount=0 then
' just one file selected!
MsgBox "You selected one file: " & whichone(0)
' check status of Read Only checkbox
' is bit 1 set or cleared?
' works only if just one file was selected!
MsgBox "Returned flag: " & flag
if (flag and 1) then
' (flag and 1)<>0, transforms to true
' bit is set!
MsgBox "ReadOnly selected!"
else
MsgBox "ReadOnly not selected!"
end If
' check whether selected file is of default type (txt)
if (flag and 1024) then
MsgBox "selected file is no txt file!"
else
MsgBox "selected file is of default type!"
end if
else
' more than one file selected!
MsgBox "You selected " & filecount & " files!"
for x = 1 to UBound(whichone)
list = list & path & whichone(x) & vbCr
next
MsgBox list
end If
function OpenFile(title, dir, filter, index, flags)
set comdlg = CreateObject("MSComDlg.CommonDialog")
comdlg.filter = filter
comdlg.FilterIndex = index
comdlg.Flags = flags
comdlg.MaxFileSize = 260
comdlg.CancelError = false
comdlg.DialogTitle = title
comdlg.InitDir = dir
' set txt as default
comdlg.DefaultExt = "txt"
comdlg.ShowOpen
OpenFile = comdlg.filename
' important: return flag status so your main script can
' check it:
flags = comdlg.Flags
end function
组件相关文件下载 http://xiazai.jb51.net/jbtools/vb6controls.rar
set objFile = CreateObject("SAFRCFileDlg.FileOpen")
Set objShell = CreateObject("Shell.Application")
本blog里都有示例。
如果调用vb组件,可以是:
flag = &h200
whichone = OpenFile("Choose a File!", "C:\", "Everything|*.*|TextFiles|*.TXT|Word-Documents|*.DOC", 2, flag)
MsgBox "Raw data returned: " & whichone
' Split up multi selection result:
' space is used as separator:
whichone = Split(whichone, " ")
' field index 0 contains path information:
path = whichone(0)
' list all the files:
' how many files were selected?
filecount = UBound(whichone)
if filecount=0 then
' just one file selected!
MsgBox "You selected one file: " & whichone(0)
' check status of Read Only checkbox
' is bit 1 set or cleared?
' works only if just one file was selected!
MsgBox "Returned flag: " & flag
if (flag and 1) then
' (flag and 1)<>0, transforms to true
' bit is set!
MsgBox "ReadOnly selected!"
else
MsgBox "ReadOnly not selected!"
end If
' check whether selected file is of default type (txt)
if (flag and 1024) then
MsgBox "selected file is no txt file!"
else
MsgBox "selected file is of default type!"
end if
else
' more than one file selected!
MsgBox "You selected " & filecount & " files!"
for x = 1 to UBound(whichone)
list = list & path & whichone(x) & vbCr
next
MsgBox list
end If
function OpenFile(title, dir, filter, index, flags)
set comdlg = CreateObject("MSComDlg.CommonDialog")
comdlg.filter = filter
comdlg.FilterIndex = index
comdlg.Flags = flags
comdlg.MaxFileSize = 260
comdlg.CancelError = false
comdlg.DialogTitle = title
comdlg.InitDir = dir
' set txt as default
comdlg.DefaultExt = "txt"
comdlg.ShowOpen
OpenFile = comdlg.filename
' important: return flag status so your main script can
' check it:
flags = comdlg.Flags
end function
组件相关文件下载 http://xiazai.jb51.net/jbtools/vb6controls.rar
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
更新日志
2024年11月22日
2024年11月22日
- 莫扎特弗雷德沃夏克肖斯塔科维奇《钢琴五重奏》(DG24-96)FLAC
- 证声音乐图书馆《夏至 爵士境地》[FLAC/分轨][360.16MB]
- 证声音乐图书馆《日落琴声 x 弦乐》[320K/MP3][71.2MB]
- 证声音乐图书馆《日落琴声 x 弦乐》[FLAC/分轨][342.58MB]
- 谢采妘2011《难忘的旋律(Non-StopChaCha)》马来西亚版[WAV+CUE]
- 林翠萍《听见林翠萍,记忆就会醒来》2CD[WAV+CUE]
- 木村好夫《天龍HIFI木吉他、木村好夫精选好歌》日本天龙版[WAV整轨]
- 证声音乐图书馆《日出琴声 x 民谣》[320K/MP3][53.76MB]
- 证声音乐图书馆《日出琴声 x 民谣》[FLAC/分轨][239.29MB]
- 证声音乐图书馆《绿意森林·吉他絮语》[320K/MP3][65.77MB]
- 证声音乐图书馆《绿意森林·吉他絮语》[FLAC/分轨][295.2MB]
- 证声音乐图书馆《流动与延展 彼拉提斯》[320K/MP3][56.88MB]
- 证声音乐图书馆《流动与延展 彼拉提斯》[FLAC/分轨][238.33MB]
- 张智霖2014《DEJAVU似曾相识(港版)》[WAV整轨]
- 邓丽君《Singles》2CD(金牛宫版)[正版原抓WAV+CUE]