error 70 - Permission denied

G

Guest

I am attempting some data mining online out of excel. I have managed to log
onto the site and descend down a couple levels of links to the page I want. I
know want to process all the messages on this page. All the messages are
hyperlinks that are numbered and have an
href="/group/pp_dist/message/messagenumber. I am iterating through the links
in a loop and accessing the first such link on the page works fine but the
second one is giving me the error above.

Here is the code. Please, disregard absence of error checking unless it has
a bearing on the solution.

Private Sub connect()
Dim brsr As SHDocVw.InternetExplorer
Dim doc As MSHTML.HTMLDocument
Dim link As HTMLLinkElement
Dim form As HTMLFormElement
Dim username As String
Dim passwd As String
Dim hreference As String
Dim re As VBScript_RegExp_55.RegExp

Set brsr = New SHDocVw.InternetExplorer
brsr.navigate "http://groups.yahoo.com"
'brsr.Visible = True
username = " "
passwd = " "
Set re = New VBScript_RegExp_55.RegExp
re.Pattern = "*/group/pp_dist/messages*/\d+"
re.IgnoreCase = True
re.Global = True

Do While brsr.Busy
Loop

Set doc = brsr.document
If doc.forms.Length > 2 Then
With doc
.all("login").Value = username
.all("passwd").Value = passwd
.all(".save").Click
End With
End If

Do While brsr.Busy
Loop

For Each link In doc.links
'MsgBox link.innerText
If link.innerText = "pp_dist" Then
link.Click
Exit For
End If
Next link

Do While brsr.Busy
Loop

For Each link In doc.links
'MsgBox link.innerText
If link.innerText = "Messages" Then
link.Click
Exit For
End If
Next link

Do While brsr.Busy
Loop

For Each form In doc.forms
If form.className = "getmessagenumber" Then
form.all("Message.Number.Input").Value = "1"
form.submit
Exit For
End If
Next form

Do While brsr.Busy
Loop

For Each link In doc.links
hreference = link.getAttribute("href")
If hreference Like "*/group/pp_dist/message/#*" Then
link.Click
Do While brsr.Busy
Loop
MsgBox doc.body.innerText
End If
Next link
brsr.Visible = True
End Sub
 
T

Tim Williams

.....
For Each link In doc.links
hreference = link.getAttribute("href")
If hreference Like "*/group/pp_dist/message/#*" Then
link.Click
Do While brsr.Busy
Loop
MsgBox doc.body.innerText
End If
Next link

I would guess that what is happening is that as soon as you follow the
first link the "doc" object which owns your collection of links
disappears. Try first stuffing all of the links into an array or
collection and then iterating through that (perhaps using .navigate to
get to each URL).

Tim.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top