PDA

View Full Version : Sleeper: Filling in website forms



russkie
08-11-2005, 09:40 AM
hey guys, forum newb...

so i got this pretty big problem:
i need to open up a website thru VBA, fill in a form, click on a button, fill out another form and then hit the submit button.

ive the part where i open up the website and fill out the form BUT: the real situation comes when i havta "add an image" to the form ive filled out. now to add an image you gotta click on a button inside the form. this button then causes a popup that gives a warning for performing the "add image" where if you hit "yes" itll open up new java created window where you can select where the image is on your computer.

heres what ive got so far:


Sub newbook()
prdcd = InputBox("Input the barcode", "Oh yea baby its gonna work!")
prd = InputBox("Input the Product name", "Wait till you see this!")
prdscr = InputBox("Description?", "Cant wait cmon hurry!")
prdtdscr = InputBox("Detailed description", "GO GO GO!")
prc = InputBox("Price", "tubthumping?")
lstprc = InputBox("List Price?", "I get knocked down")
avl = InputBox("How many in stock", "But i get up again")
img = InputBox("type in the source for the image", "you never gonna keep me down")
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
'On Error GoTo errHandler
With ie
With ie
.Visible = True
End With
.navigate "http://www.kinderklassics.com/xcart/provider/product_modify.php"
Do While .busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
With .document.Forms(1)
.Parent.All("Change Button").Click
.ok.Click
.newfilename.Value = img
.Apply.Click
'SKU
.ProductCode.Value = prdcd
'PRODUCT NAME
.Product.Value = prd
'PRODUCT DESCRIPTION
.descr.Value = prdscr
'DETAILED DESCRIPTION
.fulldescr.Value = prdtdscr
'PRICE
.price.Value = prc
'LIST PRICE
.list_price.Value = lstprc
'HOW MANY
.avail.Value = avl
'Author
'.efields [1].Value = athr
.categoryid.Value = "3"
.submit
End With
Do While Not CBool(InStrB(1, .document.URL, _
"cp_search_response-e.asp"))
DoEvents
Loop
Do While .busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
End With
errHandler:
ie.Quit: Set ie = Nothing
End Sub


so... the " .Parent.All("Change Button").Click" doesnt work first of all. the name of the button on the form page is "Change Button" how can i get VBA to click it?
second: how do i get excel to select or if not required to just hit "yes" to the popup. THEN
how do i get VBA to select the new java window which does NOT have an address bar so i cant select it the way i did with the original form.

i would seriuosly appreciate any help thanx alot

stanl
08-12-2005, 01:33 PM
This won't solve the issue, but you can't have a With..EndWith that opens another window without resetting focus.