【发布时间】:2016-03-11 21:48:10
【问题描述】:
我之前曾多次问过这个问题以及其他问题。从来没有得到答案。
有什么方法可以获取带有格式的网络数据并将其放入 microsoft word 中?
我根据这个答案得到了一些解决方案
HTML Text with tags to formatted text in an Excel cell
就我而言,我直接从网络获取数据。是否有任何直接的过程来获取格式化的 HTML 内容。
我的代码是:
If .Hyperlinks.Count > 0 Then
HttpReq.Open "GET", .Hyperlinks(1).Address, False
HttpReq.send
oHtml.body.innerHTML = HttpReq.responseText
StrTxt = oHtml.getElementsByClassName("class").Item.innerHTML
With IE
.Visible = True
.navigate "about:blank"
.Document.body.innerHTML = StrTxt
.Document.execCommand "SelectAll"
.Document.execCommand "Copy"
End With
Set rng = Tbl.Cell(i, 1).Range
rng.Collapse wdCollapseStart
rng.PasteAndFormat wdPasteDefault
Set rng = nothing
End If
有没有更好的方法?
【问题讨论】: