→ MOONRAKER:(1)這是沒可能的(2)看後一篇 05/07 23:05
我目前用CommonDialog + FileSystemObject可以成功的開啟並讀取.txt格式的檔案資料
語法如下
'使用CommonDialog物件
With CommonDialog1
.CancelError = True
.DialogTitle = "開啟檔案"
.Filter = "Excel格式檔 (*.xls)|*.xls|文書檔 (*.doc;*.txt)|*.doc;*.txt"
.ShowOpen
'用FileSystemObject來讀取.txt檔
Set fs = CreateObject("Scripting.FileSystemObject")
Set txtf = fs.OpenTextFile(.filename, ForReading)
Temp = txtf.ReadAll
txtf.Close
End With
那我想請問各位 是否可以用 CommonDialog + FileSystemObject來讀取.xls
等excel的格式呢?
我直接用這樣的方法開啟.xls檔案 結果程式只偵測出1個資料
(但其實.txt檔裡有50個資料) 是檔案格式的問題嗎?
請問有沒有比較適合讀取excel檔案的方法 謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.195.202.61