- 帖子
- 20
- 主題
- 5
- 精華
- 0
- 積分
- 61
- 點名
- 0
- 作業系統
- xp
- 軟體版本
- 2003
- 閱讀權限
- 20
- 性別
- 男
- 來自
- 台灣桃園
- 註冊時間
- 2010-9-1
- 最後登錄
- 2019-4-26
|
請問有辦法用vba讀取rar檔嗎??
如題,
我已經爬文許久都沒有相關的文章,
只有一篇比較有關,但不能用,我找到的程式碼如下:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub GetFileList()
Dim Path As String
On Error Resume Next
Path = Application.InputBox("请输入路径")
If Path = "" Then Exit Sub
If Right(Path, 1) <> "\" Then Path = Path & "\"
If Dir(ThisWorkbook.Path & "\RarFileList.txt") <> "" Then Kill ThisWorkbook.Path & "\RarFileList.txt"
Shell "cmd /c " & ThisWorkbook.Path & "\rar vb " & Path & "*.rar >>" & ThisWorkbook.Path & "\RarFileList.txt", vbHide
Do While Dir(ThisWorkbook.Path & "\RarFileList.txt") = ""
DoEvents
Loop
Sleep 600
If Dir(ThisWorkbook.Path & "\RarFileList.txt") <> "" Then Workbooks.OpenText Filename:=ThisWorkbook.Path & "\RarFileList.txt", DataType:=xlDelimited
End Sub |
|