【发布时间】:2020-07-13 23:30:56
【问题描述】:
我想提取可以在网站上找到的项目的项目状态。有关如何解析 html 的示例,请参见下文。我想提取文本 Start,它是 td 和 /td 之间的文本。请参阅下面的 html 我的代码。
<div id="ProjectStatus">
<tr>
<th>
<span id="ProjectStatus_Label1" title="De status van het project">Projectstatus</span>
</th>
<td>Start</td>
</tr>
您将在下面找到我目前拥有的代码。这段代码只给了我字符串“Projectstatus”,这不是我想要的。如何提取“开始”这个词?
Private Sub btnClick()
Dim ieApp As InternetExplorer
Set ieApp = New InternetExplorer
Set ieApp = CreateObject("internetexplorer.application")
With ieApp
.Navigate "url"
.Visible = True
End With
Do While ieApp.Busy
DoEvents
Loop
Set getStatus = ieApp.Document.getElementById("ProjectStatus_Label1")
strStatus = getStatus.innerText
MsgBox (strStatus) 'gives met the text "Projectstatus, but I need the text "Start"
ieApp.Quit
Set ieApp = Nothing
End Sub
【问题讨论】: