|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
对Word的操作不熟,抛块砖:
- Sub GetRtfData()
- Dim wApp As Object
- Dim Arr, k%, i%
- Set wApp = CreateObject("Word.Application")
- wApp.documents.Open ThisWorkbook.Path & "\1.rtf"
- wApp.Visible = False
- k = wApp.activedocument.paragraphs.Count
- ReDim Arr(1 To k, 0)
- For i = 1 To k
- Arr(i, 0) = Replace(wApp.activedocument.paragraphs(i), vbTab, "↑")
- Next
- wApp.Quit
- Set wApp = Nothing
-
- [A1].Resize(k) = Arr
- [A:A].TextToColumns Destination:=[A1], OtherChar:="↑"
- [A:A].Delete
- End Sub
复制代码 |
|