我正在尝试使用excel vba从html行(如下所示)中提取文本。
<textarea class="textareaMod task-title" id="task-description">software Developemnt</textarea>
&#13;
每次代码运行时,我都会遇到运行时错误91。以下是我的代码的一部分。任何帮助解决这个问题都非常感谢。
Dim ie As InternetExplorer
Dim html As HTMLDocument
Set ie = New InternetExplorer
ie.Visible = True
ie.navigate URLstr
Do While ie.READYSTATE <> READYSTATE_COMPLETE
Application.StatusBar = "Trying to connect to the source..."
DoEvents
Loop
Set html = ie.document
Set ie = Nothing
Application.StatusBar = ""
Dim title, header As String
title = html.getElementById("task-description").innerHTML
Activesheet.Range("B2").Value = title
答案 0 :(得分:1)
谢谢SIM和Cindy!这对我有用:
Dim Title As Object
Dim TitleTxt As String
Set Title = html.getElementById("task-description")
TitleTxt = Title.innerText
Activesheet.Range("B2").Value = Title