PC Review


Reply
Thread Tools Rate Thread

Automating Internet Explorer from VBA

 
 
Oka
Guest
Posts: n/a
 
      20th Jul 2006
Hi all, could somebody help me. I am trying to control a website from
Excel VBA. It has page source below:

<FORM class=chooser_form id=chooser_form name=chooser_form
onsubmit="return false;" action=http://www.example.com/blog.php
method=post>
<INPUT type=hidden value=en name=lang>
<DIV class=entry_url_out>
<INPUT class=entry_url name=URL>
</DIV>
<DIV class=selector_site_2_out>
<SELECT class=selector_site_2
onchange=change_info(document.chooser_form.site.selectedIndex);
name=site>
<OPTION value=Option1>Option1</OPTION>
<OPTION value=Option2>Option2</OPTION>
</SELECT>
</DIV>
<INPUT class=entry_submit onfocus=this.blur(); onclick=buttonDownload()
type=submit>
</FORM>

That website change a text into another text. Normaly under IE, we must
type on the input box in that website, and click the button.
Afterwards, that web show the result.
I guess that website use Java or Ajax programming when we clicked the
button to send XMLHTTP and send request to web server.

By this code below, I have succeed to enter a text in to the input box,
but I can't "click" in the button because that button didnt have a
name. Here is my code

Private Sub OpenWebPageAndInput_Click()
Dim objIE As Object
On Error GoTo error_handler
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Navigate "www.example.com/example.php"
Do While .Busy: DoEvents: Loop
Do While .readyState <> 4: DoEvents: Loop
.Visible = True
With .Document.Forms("chooser_form")
.URL.Value = "test"
.submit '< this line was error

End With
End With
Set objIE = Nothing
Exit Sub
error_handler:
MsgBox ("Unexpected Error, I'm quitting.")
objIE.Quit
Set objIE = Nothing
End Sub


I have tried SendKeys "{ENTER}", True but it was fail too

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating Internet Explorer =?Utf-8?B?TGF1cmE=?= Microsoft Access VBA Modules 7 19th Oct 2004 05:44 AM
Automating Internet Explorer =?Utf-8?B?TGF1cmE=?= Microsoft Access VBA Modules 0 12th Oct 2004 01:01 AM
Automating Internet Explorer =?Utf-8?B?TGF1cmE=?= Microsoft Access VBA Modules 0 12th Oct 2004 12:59 AM
Automating Internet Explorer =?Utf-8?B?TGF1cmE=?= Microsoft Access VBA Modules 0 12th Oct 2004 12:59 AM
Automating Internet Explorer =?Utf-8?B?TGF1cmE=?= Microsoft Access VBA Modules 0 12th Oct 2004 12:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:38 PM.