Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have an HTML in my Excel:

<form name="scform" action="online_range.aspx" autocomplete="off">
<input name="AcctNo" type="hidden" value="3949067512">
<table width="100%" border="0" cellpadding="3">
<tbody><tr>
<td width="6%"></td>
<td width="18%" align="center" valign="middle"><font color="#ffffff" face="verdana" size="1"><b>Numbers</b>
<td width="18%" align="right" valign="middle"><font color="#000000" face="verdana" size="1">**000,000,000,000.00**</font></td>
<td width="18%" align="right" valign="middle"><font color="#000000" face="verdana" size="1">**100,100,100,100.00**</font>
<td width="5%" align="center" valign="middle"><font color="#000000" face="verdana" size="1">
<!--<a href="javascript:document.scform.submit();" onmouseover="sctest('0479281963'); window.status='Account Details'; return true;">-->
<!-- INSERT BUILDMENU - APSMITH -->
<script>BuildMenu_SCPHP(0,'')</script>
<a onmouseover="showmenu(event,linksetSCPHP[0]); sctest(479281963, 'IM'); window.status='Account Details';" onmouseout="delayhidemenu()" href="javascript:document.scform.submit();">
<!-- END BUILDMENU - APSMITH -->
<img width="21" height="17" src="/images/detail2.gif" border="0"></a>
</font>
</td>
</tr>
</tbody></table></td>
<td width="3%"></td>
</tr></tbody></table></form>

I want to get the value from the td which is 000,000,000,000.00 and 100,000,000,000.00 but have no luck.

Here's what i tried:

Dim IE As New InternetExplorer
Dim Doc As HTMLDocument

Set IE = CreateObject("InternetExplorer.Application")

IE.Visible = True

'Navigate to Website
IE.navigate "https://secure1.bpiexpressonline.com/AuthFiles/login.aspx?URL=/direct_signin.htm"

'Loop until page load complete
Do
    DoEvents
    Loop Until IE.readyState = READYSTATE_COMPLETE

Set Doc = IE.document
Doc.getElementById("UserID").Value = Range("E23").Value
Doc.getElementById("Password").Value = Range("E24").Value

Doc.getElementById("login").submit
'Loop until page load complete
Do
    DoEvents
    Loop Until IE.readyState = READYSTATE_COMPLETE

'Dim tb As Object, tr As Object, th As Object
Dim tb As Object
Set tb = Doc.getElementsByTagName("AcctNo")

what to do here? i tried getElementsById(td)(1) and so on, but no luck.

by using getElementsById(td)(n) there's no error but what the output is wrong, can someone help me or teach me how to parse form type.

thanks in advance

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
213 views
Welcome To Ask or Share your Answers For Others

1 Answer

As I understand you have difficulties with constructing path to desired element?

1) Add id attribute to your table row element, it will be:

<table width="100%" border="0" cellpadding="3">
<tbody><tr id="row_1">

2) Now you can use:

Dim row As Object
Set row = Doc.getElementsByTagName("row_1");

3) Now you can retrieve get your values like this:

row.getElementsByTagName("td")(1).getElementsByTagsName("font")(1).innerText

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...