Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Createobject(internetexplorer.application) loop... 1

Status
Not open for further replies.

petrosky

Technical User
Aug 1, 2001
512
AU
Hi,

I have recently found some code to dump some varables into a website from an excel sheet.

Here is the code in full.
Code:
Sub WebSubmit2()

Dim obIE As Object
Dim vURL As String
Dim i As Integer
Dim lastrow As Integer
Dim webname As String


lastrow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row


vURL = "[URL unfurl="true"]http://server/test/index.html"[/URL]

Set obIE = CreateObject("InternetExplorer.Application")

obIE.navigate (vURL)

While obIE.Busy = True
  DoEvents
Wend

obIE.Visible = True

With obIE.Document
  For i = 2 To lastrow
  webname = Range("B" & i).Value
.all.Item(webname).Value = Range("E2")
.Forms(0).submit

Next i

End With

Set obIE = Nothing

Exit Sub

err_catch:
    MsgBox ("Error Number " & Err.Number & ".  " & Err.Description)
End Sub
Basically it gives an error on this line
Code:
.all.Item(webname).Value = Range("E2")
The variable webname is the name of the text box on the webpage in question.

I have about 200 of these item names in column B.

I would like to iterate through each and assign the value.

Any help is appreciated.

Remember- It's nice to be important,
but it's important to be nice :)
 
Reference 'Microsoft Internet Controls' (shdocvw.dll) and 'Microsoft HTML Object Library' (MSHTML.tlb) libraries, look at 'InternetExplorer', 'WebBrowser' and 'HTMLDocument' classes in Object Browser. This can be a starting point in digging in the object model.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top