佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > vbs選擇文件夾效果代碼

vbs選擇文件夾效果代碼

熱門標(biāo)簽:服務(wù)器配置 呼叫中心市場(chǎng)需求 銀行業(yè)務(wù) 網(wǎng)站文章發(fā)布 鐵路電話系統(tǒng) 檢查注冊(cè)表項(xiàng) 美圖手機(jī) 智能手機(jī)
不用組件的話有兩種辦法: 

set objFile = CreateObject("SAFRCFileDlg.FileOpen") 
Set objShell = CreateObject("Shell.Application") 

本blog里都有示例。 

如果調(diào)用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 

組件相關(guān)文件下載 http://xiazai.jb51.net/jbtools/vb6controls.rar

標(biāo)簽:長(zhǎng)治 樂山 滄州 沈陽(yáng) 新疆 上海 河南 紅河

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《vbs選擇文件夾效果代碼》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    五华县| 沧州市| 洛阳市| 栾城县| 堆龙德庆县| 来凤县| 安阳县| 友谊县| 前郭尔| 汝州市| 鄯善县| 云安县| 农安县| 汉寿县| 杂多县| 武陟县| 马边| 工布江达县| 昌邑市| 长宁县| 通海县| 寿阳县| 宣城市| 贵溪市| 泊头市| 治多县| 新龙县| 武陟县| 永城市| 临西县| 清原| 九江市| 南投市| 临沧市| 东阳市| 泾川县| 庐江县| 瓮安县| 军事| 冀州市| 汉中市|