国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > VBScript > 正文

vbs選擇文件夾效果代碼

2019-10-26 18:01:33
字體:
來源:轉載
供稿:網友
不用組件的話有兩種辦法: 

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 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 辽源市| 资源县| 泸溪县| 娄烦县| 汝阳县| 双鸭山市| 泾源县| 桦南县| 哈密市| 青田县| 卓尼县| 乾安县| 宝清县| 宜宾市| 志丹县| 凤凰县| 观塘区| 晴隆县| 临沭县| 杭锦旗| 镇康县| 闽清县| 阜阳市| 宁蒗| 临沧市| 邵武市| 万年县| 响水县| 瓮安县| 泊头市| 霸州市| 津南区| 南安市| 石楼县| 罗江县| 大宁县| 焦作市| 民权县| 酒泉市| 葫芦岛市| 高碑店市|