Inserting text from Excel to Internet Explorer into a inputbox with a Input mask

adibakale

Board Regular
Joined
Apr 10, 2015
Messages
52
I have written a macro that sends text from excel to an input box on a website to be used as for a search. The code works fine for other textboxes, however this textbox is giving me issues. It seems that it is inserting the text as a input mask instead of the actual value.

Here is my VBA code that inserts the text:

Code:
.getElementById("[I]element_id[/I]").Value = ssn

Here is the inputbox that i need to put the text into:

HTML:
<input name="element_name" class="quickSearchType" id="element_id" onkeydown="if(event.keyCode == 13){document.getElementById('element_id').click(); return false;}" onfocus="javascript:QSGotFocus();" onchange="javascript:QSChanged();" type="text" size="20" value="Enter SSN...">

When I click in the input box then run the code, it seems to work. I am thinking that I need to set focus to the textbox before adding text, but not sure how to do that.

Right now, when I run the code, it shows a greyed out text/input mask instead of the actual value.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I am thinking that I need to set focus to the textbox before adding text, but not sure how to do that.
Try:
Rich (BB code):
.getElementById("element_id").Focus
Or look at FireEvent (<=IE8) or DispatchEvent (>=IE9). That's all I can suggest without knowing the URL and being able to access it.
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,624
Members
449,240
Latest member
lynnfromHGT

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