Hi Excel Forum,
I am attempting to input the contents of a cell into a textbox on internet explorer using VBA.
The element I am attempting to interact with is as follows:
<div contenteditable="true" id="search-box" autocomplete="off" class="ui-autocomplete-input ui-corner-all">ranitidine</div>
Where I have placed "ranitidine" is where the value appears in the element when manually typed into the browser.
So far I have tried:
For Each itm In IE.document.all
If itm = "[object HTMLInputElement]" Then
n = n + 1
If n = 3 Then
itm.Value = "ranitidine"
itm.Focus
Application.SendKeys "{w}", True
GoTo endmacro
End If
End If
Next
IE.document.getelementsbyclassname("ui-autocomplete-input ui-corner-all").value = "ranitidine"
IE.document.getelementbyid("search-box").value = "ranitidine"
These three methods have failed to input the value "ranitidine" into the textbox.
SendKeys successfully sends values to the textbox; however, I am unaware if this can be used to input the contents of a cell.
Any suggestions are appreciated
Bookmarks