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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Filling out IE form, but can't find form name

Status
Not open for further replies.

makavity

Programmer
Nov 23, 2003
36
0
0
US
I've been working on a macro to check inventory on merchandise.

When I run the "Get Field" macro by CautionMP, the results are blank.

Checking "For Each" form with a macro, it skips past the "Next" giving me reason to think there are no forms or they've hidden it beyond my skills.

I believe the text box I'm looking for (in the HTML below) is "ht_itemnumber" but I have never tried to fill out a form without knowing the form name.

I'm trying to fill out the Item Number and hit "GO" so I can gather the data on the resulting table.

How would this be done?

Any Advice is appreciated. Thanks!


HTML Text:
<html>

<head>
<title>Item</title>
</head>

<body BGCOLOR="#FFFFFF">
<form method="POST" action="itemsel.htm">
<INPUT TYPE="HIDDEN" NAME="HslKitList" VALUE=",Pre-Built,BOD">
<INPUT TYPE="HIDDEN" NAME="HslItemTypeList" VALUE=",Stock,Non-Stock,Consumable,Labor">
<INPUT TYPE="HIDDEN" NAME="sid" VALUE="RiUEdjJhHccxhwkn.r">

<BLOCKQUOTE>
<table border="0" width="377" height="275">
<tr>
<td colspan=2><font size=+1><strong>Select Inventory By:</strong></font></td>
</tr>
<tr>
<td width="123" height="42" align="right"><strong>Item :</strong></td>
<td width="242" height="42"><input type="text" name="ht_itemnumber" size="20" VALUE=""></td>
</tr>
<tr>
<td width="123" height="39" align="right"><strong>Item Type:</strong></td>
<td width="242" height="39"><select name="hsl_itemtype" size="1">
<OPTION>
<OPTION>Stock
<OPTION>Non-Stock
<OPTION>Consumable
<OPTION>Labor
</SELECT></td>
</tr>
<tr>
<td width="123" height="37" align="right"><strong>Kit:</strong></td>
<td width="242" height="37"><select name="hsl_kit" size="1">
<OPTION>
<OPTION>Pre-Built
<OPTION>BOD
</SELECT></td>
</tr>
<tr>
<td width="123" height="40" align="right"><strong>Description :</strong></td>
<td width="242" height="40"><input type="text" name="ht_description" size="20" VALUE=""></td>
</tr>
<tr>
<td width="123" height="55" align="right"><strong>Product Group:</strong></td>
<td width="242" height="55"><input type="text" name="ht_prodgroup" size="20" VALUE=""><input
type="submit" value="Go" name="bt_go"></td>
</tr>
</table>
</BLOCKQUOTE>
</form>
</body>
</html>

The web page has 5 fields. An "Item Number" (which is what i want to fill out), 2 drop down lists "Item Type" and "Kit", a "Description" box, and a "Product Group" box. (and a "GO" button). I'll need to hit "GO" once I've managed to fill out the form. Thanks again!
 



huh???

Are your comments referring to your example???

You have posted no code, so how do you expect a cogent response to your questions???

This is a VBA forum. What APPLICATION are you coding in?

Please answer each of these questions, clearly, concisely and completely.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Using Excel VBA to fill out a web page.

Using something similar to:

Set objParent = objIE.Document.Forms("?")
With objParent
objParent.Item("hsl_itemtype").Value = "123456"
.Submit
End With
While objIE.Busy
Wend

But the web page does not show the form name, and running CautionMP's "Get Fields" macro from the FAQ returns nothing. I have never run across this yet, so not sure how to proceed.

Ultimately I want to enter an item number in the item number space from Excel.
 


try...
Code:
Set objParent = objIE.Document.Forms(1)

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Using:

Thanks for the reply.

Dim objIE As Object
Dim objParent As Object
Set objParent= objIE.Document.Forms(1)
With objParent
objParent.Item("ht_itemnumber").Value = "123456"
End With

Returns an error:
Run-time error '91':
Object variable or With block variable not set

I tried Forms(1) thru Forms(10) as well to see if that would find it.
 



faq707-4594

You might try ZERO



Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Ya, I tried (0) as well. It returns the error as well.

Thanks for posting the Watch FAQ. Had never tried that before.

The value of the object "objParent" is "Nothing" in the watch window. Not sure how to dig around to see what objects / forms are on the page.
 
Where and how is objIE instantiated ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I'm using this to open the site:

Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = True
.Navigate "My_Web_Page"
End With
While objIE.Busy
Wend
While objIE.Document.readystate <> "complete"
Wend

It works for filling out the log-in form, but this page apparently has the form hidden.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top