For the past two days, I have been working hard trying to figure out how to automate an internal site here at work so we can process bulk items via excel on an internal site.
I have made some progress today, but now I am totally stuck. I have been reading eveything I can on htmldocument, but my head is spinning.
The website is a very simple website.
You take an input, click a button. This will them create a small HTML table with a text input box and another button.
The code ieForm(1).Value = tcode works. The code ieForm.submit also hits submit on the button.
The problem is I cannnot figure out how to access the 2nd button which is generated when you click the 1st button. I have tried every variation of ieForm(1).Value. There appears to be only 3 forms (0, 1, 2). When I try 3 or greater, I get an error.
When I use ieForm(2).Value = "something", the Retrieve button text actually changes name to "something".
I've attached a screen shot of the webpage. I can insert text into the top Track Code box, and click Retrieve.
I can't change the text in the Routing Position field, and I cannot click the "Set" button. Any help would be greatly appreciated.
I am still a beginner with VBA and it took me a while just to get it to work with the 1st input box.
I have made some progress today, but now I am totally stuck. I have been reading eveything I can on htmldocument, but my head is spinning.

The website is a very simple website.
You take an input, click a button. This will them create a small HTML table with a text input box and another button.
Code:
Sub VisitWebsite()
Dim ie As Object
Dim tcode As String
Dim sURL As String
Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")
sURL = [URL="http://sample.jsp/"]http://sample.jsp[/URL]
ie.navigate sURL
ie.Visible = True
tcode = "apples"
While ie.busy
DoEvents
Wend
Application.Wait Now() + TimeValue("00:00:03")
For Each ieForm In ie.document.forms
ieForm(1).Value = tcode
ieForm.submit
Set ieForm = Nothing
Exit For
Next
The code ieForm(1).Value = tcode works. The code ieForm.submit also hits submit on the button.
The problem is I cannnot figure out how to access the 2nd button which is generated when you click the 1st button. I have tried every variation of ieForm(1).Value. There appears to be only 3 forms (0, 1, 2). When I try 3 or greater, I get an error.
When I use ieForm(2).Value = "something", the Retrieve button text actually changes name to "something".
I've attached a screen shot of the webpage. I can insert text into the top Track Code box, and click Retrieve.
I can't change the text in the Routing Position field, and I cannot click the "Set" button. Any help would be greatly appreciated.

