try to log in to web site by using excel vb, but not sure the butt

G

Guest

here is the Source of the website

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN">
<HTML><HEAD>
<TITLE>XXX Internet Administration System - Login</TITLE></HEAD>
<BODY BGCOLOR=#FDBD49>
<FORM METHOD=POST ACTION="http://XXXX/XXX/XXXX">
<INPUT TYPE=HIDDEN NAME=scr VALUE="login.cgi">
<CENTER>
<P><BR><P>
<B>Before you can access this function, you will need to login</B>
<P>
<B>Operator ID:</B>
<INPUT TYPE="TEXT" NAME="SEC_username" Size=10 VALUE="">
<P>
<B>Password:</B>
<INPUT TYPE="PASSWORD" NAME="SEC_password" Size=10 VALUE="">

<P><BR><P>
<INPUT TYPE="HIDDEN" NAME="scriptname" VALUE="/cgi-bin/ias.cgi">
<INPUT TYPE="HIDDEN" NAME="parameters" VALUE="scr=menu_main%2ecgi">
<INPUT TYPE="HIDDEN" NAME="SEC_usertype" VALUE="operator">

<INPUT TYPE="SUBMIT" VALUE="LOGIN">
<INPUT TYPE="RESET" VALUE="Clear">
</CENTER>

</FORM>

</BODY>
</HTML>



Sub XXXXX()

'log into XXXXXXX.XXX

Dim a, b As Variant

a = InputBox("input your UserID")
b = InputBox("input your password")
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "http://XXXX/XXX/XXXX"

Do While IE.Busy And Not IE.readyState = 4:
Application.Wait (Now + TimeValue("0:00:02"))
DoEvents
Loop

IE.document.all("SEC_username").Value = a
IE.document.all("SEC_password").Value = b
Set ipf = IE.document.all.Item("cmd")
ipf.Click

End Sub

not sure if I put down the right button command to click it. Anyone can help?
 
T

Tim Williams

Try

document.forms(1).submit

[or forms(0): can never remember if it's zero-based or not...]
Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top