Results 1 to 2 of 2

Thread: VBA for find Empty Text box in Web Page

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2017

    Lightbulb VBA for find Empty Text box in Web Page

    Hello Everyone,
    I have to fill some data from Work book to Web page on daily basis. web page looks like workbook, they have sequence order (Element id like "Mytext_1","Mytext_2","Mytext_3"......).
    I want to find the Empty text box on web page through VBA, if the Text box have some values, then data should update next empty text box.
    I don't know is it possible or not,Please help me anyone if possible.

    Thanks in Advance.

  2. #2
    Join Date
    Dec 2004

    Re: VBA for find Empty Text box in Web Page

    you could try something like

    for i = 1 to somenumber
         if doc.getelementbyid("mytext_" & i).value = "" then doc.getelementbyid("mytext_" & i).value = somedata
    where doc is an html document object and somenumber is the highest mytext number, you would need to increment the data for the next empty box, or exit for if the last data is assigned
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed

Posting Permissions

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


Click Here to Expand Forum to Full Width