Unable to click tab on web page using macro

mks_2912

New Member
Joined
Aug 13, 2017
Messages
2
Hi,

I am new to macros. I am writing my first code to fill some fields in web page and save it. The page is having few tabs, on clicking the tabs fields will be displayed on some part of same page for the corresponding tabs, where i am trying to fill the data.

Below is the html code for one of the tab

<a id="TabRequirementst" class="greyRoundbtn active"?
<span class="bRt">
<span class="bMid">Requirements</span>
<span>
</a>

And below is the html code for one of the field under above tab

<input class="enhanced" id="systemcontrol_0_TextBox" name="systemcontrol[0].TextBox" type="text value tabindex="110">


I have written below code to click the tab and enter the text in the field under that tab, but getting "error 424: Object required" at the tab ".click" code line.



IE.document.getelementbyid("TabRequirementst").click
IE.document.getelementbyid("systemcontrol_0_TextBox").value ="enter text here"


and changed the code like below, this time getting error "Object not found" at "enter text here" code line

<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">Dim e as Object
For
Each e In ie.document.getElementsByTagName("span")
If e.InnerText = "Requirements" Then
e
.Click
Exit For

End If
Next
IE.document.getelementbyid("systemcontrol_0_TextBox").value ="enter text here"
</code>
If i debug the code step by step it is working fine for both the codes. But if i run the code it is not working

Can someone help me with the steps if i miss anything.

Thanks!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,215,589
Messages
6,125,695
Members
449,250
Latest member
azur3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top