Re: Access wab page with excel VBA



Hi Madiya

If you view the source code for the web page you should be able to
find the ID to the button, the HTML below is from an intranet site
that holds a basic login form that requires a user name and password,
then a button click to start the login with the data given or to reset
the form.

<form name="login" method="POST" action="/Basic/login.asp">
<p>Username:
<input name="txtUserName" type="text" id="txtUserName" size="10"
maxlength="10">
</p>
<p>Password:
<input name="txtPassword" type="password" id="txtPassword" size="10"
maxlength="10">
</p>
<p>
<input type="reset" name="Reset" value="Reset">
<input name="Submit" type="submit" id="Submit" value="Submit">

in this case if i wanted to automatically control this page i would
set an object for the things i need, one for the Username and password
and one for the button, i can set the object to reference an item on
the web page by setting the object to the ID of the webpage
control ...

Set MyObject = ie.document.all.Item("txtPassword")

then i can use that control

MyObject.value="drowssap"

as for the buttons i don't need to set them to an object but i do
however need to call them by the correct ID

ie.document.all.Item("Submit").click 'Where Submit is the button ID
taken from the HTML code.

however you need to remember to clean up after yourself if you are
creating and setting objects, when you are done with them set them
back to nothing. I normally do this at the end of the function or sub
so i always know where to look to see if they have been reset...

Set NameCbo = Nothing
Set PsWord = Nothing
Set Ref = Nothing
Set InstLnk = Nothing
Set Lnk = Nothing

I hope this clears things up for a you a bit but if not let me know
and i shall see what i can come up with.

Steve


.