PDA

View Full Version : pulling excel variable into webform and submit



jayinthe813
09-05-2012, 09:06 AM
Im able to authenticate into my webpage using:

Sub logmein()
Set ie = CreateObject("internetexplorer.application")
ie.navigate2 "internalsite.com"
Do Until ie.readystate = 4
DoEvents
Loop
ie.Visible = True

'set form for login

Set lform = ie.document.forms(0)
lform("USER").Value = "user"
lform("PASSWORD")Value = "pass"
lform.submit
End Sub

After the login page, I reach a splash page with 3 frames. The first(top) frame is the frame i need to find the element ID, and add the value to the textbox then submit, which i intend to use a variable (pulling from excel). Im not sure how to identify the frame, or form number (Ive found 0 was the default for login page). Is there an easy way to figure out the proper (index?) numbers for the forms and frame?


ie.document.frames(0).document.forms(0).getelementbyid("contractNum").Value = "212" ' I can shorten this later using above code after i figure out how to identify the index number of my frame and form

CodeNinja
09-06-2012, 07:48 AM
Omnibuster forwarded me this tool, and it was of great help to me in some of my projects.... Not sure who wrote it (CMP?) but it displays all the forms and elements of a web page pretty graphically and easily.

http://www.tek-tips.com/faqs.cfm?fid=6399


Hope it helps you as much as it has helped me.

Good luck,

CodeNinja.