I've been looking tutorials and examples of setting the value field of a input tag. I'm trying to enter two IP addresses into the text fields on this website, under IP Range To CIDR. But my code won't enter anything.

There's no ID tag, so I can't use the getElementById method.

Inspect.PNG

Dim url As String

Sub ConvertIPRangeToCIDR()

    Dim IE As InternetExplorer
    Set IE = New InternetExplorerMedium

     With IE
        .Visible = True
        url = "https://www.ipaddressguide.com/cidr"
        .navigate (url)

        While IE.Busy
            DoEvents
        Wend

        Dim Elements As Object
        Set Elements = IE.Document.getElementsByTagName("input")
        For Each Element In Elements
            If Element.Name = "ipFrom" Then
                Element.Value = "1.32.204.128"
            Exit For
            End If
        Next Element
        End With
End Sub

From tutorials this looks easy, but I've been trying different things and nothing is working.

I got it to work by changing lines 5 & 6 to:

    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")

Not sure how the previous method was not working.