Hi,

use this code

Tools ------>  Referance
Add

   Microsoft Internet Controls
   Microsoft HTML Object Library


Dim brs As InternetExplorer
Sub IE()
Set brs = New InternetExplorer
With brs
 .Visible = True
 .Navigate "http://Google.com";
End With
Do While brs.Busy Or brs.ReadyState <> READYSTATE_COMPLETE
   DoEvents
Loop
Call TextBox("q", "VBA")
Call Button("Google Search")
End Sub
Public Function TextBox(Name As String, Text As String) As Boolean
' Fill textbox Name with Text
Dim Element As Variant
brs.Document.getElementByid(Name).Value = Text
End Function

Public Function Button(Caption As String) As Boolean
' Clicks the button containing text Caption or returns false if button
cannot be found
Dim Element As HTMLButtonElement

Button = True
For Each Element In brs.Document.getElementsByTagName("Input")
If InStr(Element.Value, Caption) > 0 Then
Call Element.Click
Call LoadPage
Exit Function
End If
Next Element
Button = False
End Function
Sub LoadPage()
' Pauses execution until the browser window has finished loading
Do While brs.Busy Or brs.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
End Sub

with Regards,
Bala





--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to