Gb.pandey
03-30-2015, 05:56 AM
Hi Guys
This is my First Post. I have some knowledge of VBA.
I need to put my cursor on a text box on web page and then move to next using tab.
Here is code of webpage:
<tr>
<td class=caption_display width = "4%"><center>3.</center></td>
<td class=caption_Mandatory width = "20%">Name of Applicant</td>
<td class=caption_data colspan =3 width = "76%"><input style="width=200;" type=textbox name=txtName maxlength=50 onfocus="return countdatavalue(ofrm.txtName.value);" onblur="return countervalues(ofrm.txtName.value);" value=></td>
</TR>
<tr>
<td class=caption_display width = "4%"><center>4.</center></td>
<td class=caption_Mandatory width = "20%">Address of Applicant </td>
<td class=caption_data colspan =3 width = "35%"><input style="width=250;" type=textbox name=txtAddress maxlength=100 onfocus="return countdatavalue(ofrm.txtAddress.value);" onblur="return countervalues(ofrm.txtAddress.value);" value=></td>
</TR>
My code is :
Private Sub CmdFillData_Click()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.Navigate "*****webpage"
'wait until first page loads
Do Until .READYSTATE = 4
DoEvents
Loop
On Error Resume Next
End With
With IE.document
Application.Wait (Now + TimeValue("0:00:02"))
.forms("frmSacfa").all("txtName").setfocus
.forms("frmSacfa").all("txtName").Value = "Govind"
' SendKeys "{TAB}", True
.forms("frmSacfa").all("txtAddress").Value = "Dwarka"
End With
'Set IE = Nothing
End Sub
I need to navigate using tab to activate a button on webpage. Kindly suggest.
This is my First Post. I have some knowledge of VBA.
I need to put my cursor on a text box on web page and then move to next using tab.
Here is code of webpage:
<tr>
<td class=caption_display width = "4%"><center>3.</center></td>
<td class=caption_Mandatory width = "20%">Name of Applicant</td>
<td class=caption_data colspan =3 width = "76%"><input style="width=200;" type=textbox name=txtName maxlength=50 onfocus="return countdatavalue(ofrm.txtName.value);" onblur="return countervalues(ofrm.txtName.value);" value=></td>
</TR>
<tr>
<td class=caption_display width = "4%"><center>4.</center></td>
<td class=caption_Mandatory width = "20%">Address of Applicant </td>
<td class=caption_data colspan =3 width = "35%"><input style="width=250;" type=textbox name=txtAddress maxlength=100 onfocus="return countdatavalue(ofrm.txtAddress.value);" onblur="return countervalues(ofrm.txtAddress.value);" value=></td>
</TR>
My code is :
Private Sub CmdFillData_Click()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.Navigate "*****webpage"
'wait until first page loads
Do Until .READYSTATE = 4
DoEvents
Loop
On Error Resume Next
End With
With IE.document
Application.Wait (Now + TimeValue("0:00:02"))
.forms("frmSacfa").all("txtName").setfocus
.forms("frmSacfa").all("txtName").Value = "Govind"
' SendKeys "{TAB}", True
.forms("frmSacfa").all("txtAddress").Value = "Dwarka"
End With
'Set IE = Nothing
End Sub
I need to navigate using tab to activate a button on webpage. Kindly suggest.