enrique63
10-20-2011, 12:23 PM
How do I modify the code below so that I can input data into an internet form? The internet form seems to have frames, which I'm not familar with. Unfortunately, the internet page is internal, but I've attached the source code for your reference.
The webpage has 3 frames, each with an input, but at this point, I'm just trying to input "143709" into the first input field. Any help would be appreciated, even a working example to help me adapt my code would be great!
Sub ePAF()
Dim i As Long
Dim objIE As Object
Dim objElement As Object
Dim objCollection As Object
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.navigate "https://www03/ePAF/PAF.aspx?Mode=New"
Do While objIE.Busy
DoEvents
Loop
Set objCollection = objIE.Document.forms(1).all("aspnetForm").getelementsbytagname("input")
i = 0
While i < objCollection.Length
If objCollection(i).Name = "ctl00$ContentPlaceHolder1$txtEmpSearch" Then
objCollection(i).Value = "143709"
End If
If objCollection(i).Type = "submit" And objCollection(i).Name = "ctl00$ContentPlaceHolder1$btnMultPositions" Then
Set objElement = objCollection(i)
objElement.Click ' click button to submit
End If
i = i + 1
Wend
Set objIE = Nothing
Set objElement = Nothing
Set objCollection = Nothing
End Sub
The webpage has 3 frames, each with an input, but at this point, I'm just trying to input "143709" into the first input field. Any help would be appreciated, even a working example to help me adapt my code would be great!
Sub ePAF()
Dim i As Long
Dim objIE As Object
Dim objElement As Object
Dim objCollection As Object
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.navigate "https://www03/ePAF/PAF.aspx?Mode=New"
Do While objIE.Busy
DoEvents
Loop
Set objCollection = objIE.Document.forms(1).all("aspnetForm").getelementsbytagname("input")
i = 0
While i < objCollection.Length
If objCollection(i).Name = "ctl00$ContentPlaceHolder1$txtEmpSearch" Then
objCollection(i).Value = "143709"
End If
If objCollection(i).Type = "submit" And objCollection(i).Name = "ctl00$ContentPlaceHolder1$btnMultPositions" Then
Set objElement = objCollection(i)
objElement.Click ' click button to submit
End If
i = i + 1
Wend
Set objIE = Nothing
Set objElement = Nothing
Set objCollection = Nothing
End Sub