Consulting

Results 1 to 1 of 1

Thread: Problem in automating form filling web page.

  1. #1

    Problem in automating form filling web page.

    Following code does not work please help.

    VBAProject/Module1
    
    Option Explicit
    
    Sub iframeFormFilling()
      Dim rng As Excel.Range
      Dim rOffset As Byte
      Dim IE As Object
      Dim objElement As Object
      Dim objElement1 As Object
      Dim eleCollection As Object
      Dim ele As Object
      
      Set rng = ThisWorkbook.Sheets(1).Range("A2")
      rOffset = 0
      Set IE = CreateObject("InternetExplorer.Application")
      
      IE.Visible = True
      IE.Navigate "https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe"
      Application.StatusBar = "Web page loading. Please wait..."
      
      Do While IE.Busy
    '        Application.Wait DateAdd("s", 1, Now)
        DoEvents
        
      Loop
      
      Application.StatusBar = "Form is getting filled. Please Wait..."
      
      Set eleCollection = IE.document.getelementsbytagname("DIV")
      Dim cc As String
      
      For Each ele In eleCollection
        
        If ele.classname = "CodeMirror-scroll" Then 'CAN'T GET ELEMENT AND NOT TRIGGERING
          Debug.Print ele.innertext
          ele.innertext = """" & "<!doctype html>"""
        End If
        
      Next
      Debug.Print objElement.innertext
      
    End Sub

    Untitled3.jpg
    Last edited by J FelixBosco; 04-01-2018 at 05:00 AM.

Posting Permissions

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