How to pass text to web page ?

M

moonhk

How to pass text to web page search box ?

How to Set obj = ie.Document.all.Item("???")

Option Explicit
Sub Testing_1()
Dim ie As InternetExplorer
Dim obj As Object
'~~ Prepare to open the web page
Set ie = New InternetExplorer
With ie
.Visible = True
.Navigate "http://www.yahoo.com/"
End With

'~~ loop until the page is fully loaded
With ie
Do Until Not .Busy
DoEvents
Loop
End With
Set obj = ie.Document.all.Item("searchlabel")
If Not obj Is Nothing Then
obj.Value = "Testing"
End If

Set ie = Nothing
MsgBox "Done"
End Sub
 
M

moonhk

Hi NickHK
Below is www.ibm.com, part of html
how to get/set value into name="q" ?


<form title="Search form" name="search-form" method="get"
action="http://www.ibm.com/Search/">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="1"><label for="q"><img alt="Search for:" height="1"
width="1" src="//www.ibm.com/i/c.gif" /></label></td>
<td align="right"><input value="ERIC" type="text" size="15" name="q"
maxlength="100" id="q" class="input" /></td>
<td width="7">&nbsp;<input type="hidden" name="v" value="14" /><input
type="hidden" name="lang" value="en" /><input type="hidden" name="cc"
value="us" /><input type="hidden" name="en" value="utf" /></td>
<td><input value="Search" type="image"
src="//www.ibm.com/i/v14/t/us/en/search.gif" name="Search" alt="Search"
/></td>
<td width="20">&nbsp;</td>
</tr>
</table>
</form>
 

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