Drill Down to a Data Entry Web Form

C

cleyr

I have a macro that populates a Web Page with the data from excel. The code
below works well if the HTML page is just a flat data entry page. But when I
apply the macro to a Web Page that needs the user to login and click on a
button to get into the data entry page, it cannot recognise the web fields in
ForeignText.innertext even if the IE.LocationURL matches with the URL I
defined in the worksheet Range(“K1â€). Is there a hidden URL I need to drill
down and define? How can I do that? HELP


Sub MapMeNow()

Dim Shell As Object
Dim IE As Object
Dim response As String
Dim strServAcct As String
Dim URL As String
Dim FldX As Integer
Dim ColCount As Integer
Dim RangeCount As Integer
Dim x As Integer

Set Shell = CreateObject("Shell.Application")

RangeCount = 2
FldX = 0
ColCount = 0
x = 0

For Each IE In Shell.Windows
' Compare IE URL with URL in Range K1
If TypeName(IE.Document) = "HTMLDocument" And IE.LocationURL =
Range("K1").Value Then
URL = IE.LocationURL
IE.Navigate URL
Do While x < 50

Set ForeignCells = Range("A" & RangeCount & ":J" & RangeCount)
For Each cell In ForeignCells

Set ForeignText =
IE.Document.getElementById("H5_EV_DEST$" & x) '1
ForeignText.innertext = cell.Offset(0, ColCount).Value
If cell.Offset(0, ColCount).Value = Range("L1").Value Or
cell.Offset(0, ColCount).Value = Range("M1").Value Then FldX = 1
ColCount = ColCount + 1
Set ForeignText = IE.Document.getElementById("H5_EV_TC$"
& x) '2
ForeignText.innertext = cell.Offset(0, ColCount).Value
ColCount = ColCount + 1

If ColCount >= 2 Then Exit For
Next cell
x = x + 1
FldX = 0
RangeCount = RangeCount + 1
ColCount = 0
Loop
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top