Reputation: 8970
I openly admit I know nothing about vba..
I am working on a legacy tool for a project and its written in VBA. There is a bug I am working on and I have narrowed down the issue but unable to figure out why my string is apparently being cutoff?
strXPlusLast4 = "xxxxxxxxxxxx" & strDCLast4
For Each varItem In objIE.Document.getElementsByTagName("tr")
If InStr(varItem.innerhtml, strXPlusLast4) Then
strDCStatus = Replace(Split(Split(varItem.innerhtml, "<TD>")(3), "</TD>")(0), " ", "")
Using an IE object to navigate to a page, it is looking through the all of the tr
. Within the tr
's that it finds, it is looking to see if a string exists.
If it finds this string, it goes into the IF statement
which is where I am stuck.
Once here, I check the value of the varitem.innerHTML
and it is getting cutoff around 250 characters, right in the middle of the actual row data.
I am trying to just find out if there is any limitation as to why the value of innerHTML
is not the full HTML
content I expect to see that I am looking at on the web page it is scraping.
This data is also cutoff when I add varItem
to my watches and look at the innerHTML
of the object.
Can anyone shed any light on the little bit of code I am able to post around this issue? My root problem is that I am not getting the strDCStatus
I would expect because it is not searching the full row of data as something is getting cutoff.
Update
Here is the best I can provide for the TR
that this is looking within:
<tr class="">
<td>
</td>
<td>2 Blah Blah </td>
<td class="AccountNumber">
xxxxxxxxxxxx1234
<a href="#" onclick="view(this, event,'12345', '45678');return false" class=""><img src="https://MySite" title="Click to Expand" alt="!"></a>
</td>
<td>Closed </td>
<td>Jan 1, 2011 </td>
<td>Nov 30, 2011 </td>
<td>N/A </td>
<td>
xx/xxxx
<a href="#" onclick="view(this, event,'12345', '56789'); return false;" class=""><img src="https://MySite" title="Click to Expand"></a>
</td>
</tr>
It is using the innerHTML
so everything between the <tr>
tags. it is getting cut off around the onClick
HTML data.
The status I will eventually try and get is "Closed" in the 4th td
but I haven't been able to attempt that since I don't appear to have a full row html to look through.
Upvotes: 1
Views: 2167
Reputation: 51998
The Watches
window only shows a portion of a long string (although, unlike the Locals
window, it doesn't indicate this with a terminating ...
).
For example, when I put a watch on the variable t
in:
Sub test()
Dim s As String, t As String
Dim i As Long
For i = 0 To 9
s = s & String(50, CStr(i))
Next i
t = s
End Sub
and then copy-paste the value into notepad I see:
"0000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222223333333333333333333333333333333333333333333333333344444444444444444444444444444444444444444444444444
even though the string is clearly much longer.
The real bug in the code itself is likely due to the case-sensitivity of strings in Split
and the resulting fact that the delimiter <td>
differs from the delimiter <TD>
Upvotes: 6