+ Reply to Thread
Results 1 to 2 of 2

Unable to input text-box using VBA

  1. #1
    Registered User
    Join Date
    07-16-2019
    Location
    New Zealand
    MS-Off Ver
    365
    Posts
    44

    Unable to input text-box using VBA

    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
    Last edited by TildesleyH; 11-09-2022 at 05:04 PM.

  2. #2
    Registered User
    Join Date
    07-16-2019
    Location
    New Zealand
    MS-Off Ver
    365
    Posts
    44

    Re: Unable to input text-box using VBA

    Solved

    I was able to input the value using .innerHTML

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Unusable Files – Unable To Input
    By TheKingfish in forum Excel General
    Replies: 4
    Last Post: 04-18-2021, 09:46 PM
  2. Replies: 7
    Last Post: 11-25-2014, 10:32 AM
  3. VBA unable to pull value from input or form type using getelementsby method
    By pexpex223 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-18-2014, 08:00 AM
  4. [SOLVED] Unable to fire Private Sub Worksheet_SelectionChange on user Input
    By VirEgregius in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-31-2013, 11:02 AM
  5. Replies: 3
    Last Post: 11-08-2012, 07:25 PM
  6. Unable to input external links
    By ianm in forum Excel General
    Replies: 2
    Last Post: 12-18-2009, 10:26 AM
  7. Unable to input anything in the table
    By chewingyu in forum Excel General
    Replies: 5
    Last Post: 04-24-2009, 05:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1