How to use SendKeys to interact with Internet Explorer???

N

nisgore

Hey all,
I'm working on a program that must navigate through a website which I
have not designed myself. I have created a wait function which reloads
when the server hangs and the page comes up blank. The problem is the
dialog box that occurs when you try to reload. I've been researching
this little problem for a few weeks now, and the most common suggestion
in the internet.explorer.scripting group, is to use the get method
rather than the post method, however since I did not design the site,
this is something that I cannot change (I think, correct me if I'm
wrong on this, please).
I'm sure there must be a way of accessing the dialogbox object and
clicking the retry button, however I don't know the DOM well enough to
figure that one out entirely on my own (but if you have actually done
this and had it work, please share!!! :)).
So I'm left with trying to use the SendKeys method of trying to close
this way to annoying dialog box. Only I must be implementing it wrong,
because either it sends the "{Enter}" key command to my macro window,
and when I manually break execution, I find hundreds of carriage
returns in my code, OR the version I currently have and will post, I
just get an error saying this object or method is not supported. As
this looks like the most promesing avenue of trying to accomplish what
I'm doing, I would sure appreciate any help by those of you have
successfully used SendKeys from Excel to interact with Internet
Explorer.
I think I'm just doing something really dumb btw, in termas of creating
a variable for it... but I'm not sure and have spent the last two days
trying everything I could think of.... so if there's ANYONE out there
who can help....
:eek:D
Thanks,
Mike

'[CODE SECTION]==============================================
Sub waitForPageLoad()
Dim IExp As InternetExplorer
Dim browserwindow As InternetExplorer
Dim refreshTime As Variant

Set IExp = GetObject(, "InternetExplorer.Application")
Set browserwindow = IExp

refreshTime = Now + TimeValue("0:00:30")
Do Until browserwindow.ReadyState = 3
If Now = refreshTime Then
browserwindow.Stop
browserwindow.Refresh
'This is the problem here...
IExp.SendKeys "{Enter}" 'Run-time error "438": Object doesn't

'support this property or method.

refreshTime = Now + TimeValue("0:00:30")
End If
Loop

Do Until browserwindow.ReadyState = 4
Loop

End Sub

'[END CODE]===============================================
 

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