Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How Can I Click an un-name IE button via VBA


Hi all.
I am trying to control a website from Excel VBA. It has page sourc
below:

<FORM class=chooser_form id=chooser_form name=chooser_form
onsubmit="return false;" action=http://www.example.com/ 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_
onchange=change_info(document.chooser_form.site.se lectedIndex)
name=site
<OPTION value=Option1Option1</OPTION
<OPTION value=Option2Option2</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 mus
type on the input box in that website, and click the button. Afterwards
that web show the result.

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.htm"
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
I guess, that website use a Javascript or Ajax to send the input dat
to function "buttonDownload". Please help

--
angsok
-----------------------------------------------------------------------
angsoka's Profile: http://www.excelforum.com/member.php...fo&userid=3657
View this thread: http://www.excelforum.com/showthread.php?threadid=56316

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How Can I Click an un-name IE button via VBA

I'm no HTTP expert, but can't you submit the URL that the page would POST if
the button were clicked. e.g.
http://www.google.co.uk/search?hl=en...=Google+Search

NickHK

"angsoka" wrote in
message ...

Hi all.
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/ 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.se lectedIndex);
name=site
<OPTION value=Option1Option1</OPTION
<OPTION value=Option2Option2</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.

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.htm"
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
I guess, that website use a Javascript or Ajax to send the input data
to function "buttonDownload". Please help.


--
angsoka
------------------------------------------------------------------------
angsoka's Profile:

http://www.excelforum.com/member.php...o&userid=36571
View this thread: http://www.excelforum.com/showthread...hreadid=563165



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How Can I Click an un-name IE button via VBA


Thats the problem :)

The button is inside a frame, so I can't get the exact code within.
I have found several forum that have same problem

http://www.xtremevbtalk.com/showthread.php?t=262567
http://p2p.wrox.com/TopicIndex/16527.htm

The example of a button without name is http://login.yahoo.com/
the submit button have a source code:

<p class="yreglgsb"<input type="submit" value="Sign In"</p


--
angsoka
------------------------------------------------------------------------
angsoka's Profile: http://www.excelforum.com/member.php...o&userid=36571
View this thread: http://www.excelforum.com/showthread...hreadid=563165

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How Can I Click an un-name IE button via VBA

So if you can capture the URL that is sent, so you know its structure.
Then just build you own and send that instead.

NickHK

"angsoka" wrote in
message ...

Thats the problem :)

The button is inside a frame, so I can't get the exact code within.
I have found several forum that have same problem

http://www.xtremevbtalk.com/showthread.php?t=262567
http://p2p.wrox.com/TopicIndex/16527.htm

The example of a button without name is http://login.yahoo.com/
the submit button have a source code:

<p class="yreglgsb"<input type="submit" value="Sign In"</p


--
angsoka
------------------------------------------------------------------------
angsoka's Profile:

http://www.excelforum.com/member.php...o&userid=36571
View this thread: http://www.excelforum.com/showthread...hreadid=563165



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create floating button based on button click in menu ExcelMonkey Excel Programming 2 October 12th 05 06:43 PM
On Button Click(Help!) jpizzle[_2_] Excel Programming 1 June 3rd 05 11:32 AM
waiting for click on the button Tony Excel Programming 1 November 29th 04 05:19 PM
VBA button click need help. Need LEN help. Nigel Cummins Excel Programming 4 July 11th 03 08:52 PM
VBA button click need help. Need LEN help. Nigel Cummins Excel Programming 0 July 11th 03 09:53 AM


All times are GMT +1. The time now is 12:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"