饿虎岗资源网 Design By www.oxmxm.com
不用组件的话有两种办法:
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
饿虎岗资源网 Design By www.oxmxm.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
饿虎岗资源网 Design By www.oxmxm.com
暂无评论...
更新日志
2024年11月15日
2024年11月15日
- 文章.2004-被遗忘的时光【华博音乐】【WAV+CUE】
- 群星《青葱韶歌》原力计划·毕业季企划合辑[FLAC+分轨][661M]
- 群星《抖烧 DSD》抖音神曲 [WAV分轨][992M]
- 庾澄庆《哈林天堂》索尼音乐[WAV+CUE][1G]
- 英雄联盟全球总决赛多久打一次 全球总决赛举办频率介绍
- 第二届老头杯什么时候开始选人 第二届老头杯选人时间介绍
- 英雄联盟第二届老头杯什么时候开始 老头杯s2赛程时间队伍名单汇总
- AI赋能卓越显示技术共筑数字未来:三星显示器产品矩阵亮相2024进博会
- 技术剖析:天玑9400如何打造移动最强GPU和游戏体验?
- 顶级装备 实力登顶:三星显示器双十一焕新升级最后冲刺
- 陈影《绝色靓声》WAV+CUE
- 龚玥《禅是一枝花(6N纯银SQCD)》原抓WAV+CUE
- 刘德丽《寂寞在唱歌HQCD+A2HD5》[WAV+CUE]
- 萧亚轩《钻石糖》金牌大风[WAV+CUE][989M]
- 王菲《王菲精选-菲卖品》环球唱片SHM-SACD[ISO][1.9G]