View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gregg Roberts Gregg Roberts is offline
external usenet poster
 
Posts: 25
Default HTML Document.Links Issues

Hard to tell exactly what the problem is without seeing any code.
Are you automating IE to do your work ?


Yes.

I solved the first problem, which was occurring because it was a frames site.
Here's the relevant code for the second problem:

IeApp.Navigate LinkURL
Do
Loop Until IeApp.ReadyState = READYSTATE_COMPLETE
Set IEDoc = IeApp.Document
<snip
Set LinkTags1 = IEDoc.links

<snip

CurRow = 3
CurCol = 1
MsgBox IsEmpty(LinkTags1) ' <-- This comes back False
MsgBox LinkTags1.Length ' <-- Error 70 occurs here on the SECOND
iteration...
For LinkIndex1 = 0 To LinkTags1.Length - 1 ' <-- ...and here.
CurRow = CurRow + 1
LinkURL = LinkTags1(LinkIndex1).href
If LinkURL < "" Then ' An A tag with blank href is a bookmark, so ignore
Range(Cells(CurRow, CurCol), Cells(CurRow, CurCol)).Value = _
LinkTags1(LinkIndex1).innerText
Range(Cells(CurRow, CurCol + 1), Cells(CurRow, CurCol + 1)).Value = _
LinkURL
' if unique and internal, then get links at next level down
If URL_Is_Unique(LinkURL) And URL_Is_Internal(LinkURL) Then
IeApp.Navigate LinkURL
Do
Loop Until IeApp.ReadyState = READYSTATE_COMPLETE
Set IEDoc = IeApp.Document
Set LinkTags2 = IEDoc.links

<snip ... process second-level page and return to top