Back Forum Reply New

Web query macro Login and copy data to Excel

I have cobbled together the macro (see below) for logging onto a web site and navigating to an account page. It relies on values found in cells B1, B6 amp; B7 and works fairly well, however I would prefer not to use sendkeys.
The page source gives me the following info:

form name="LOGON" action="LOGON.pgm" method="post"
input type="hidden" name="task" value="trylogin"
Enter Your Acc Number:
input type="text" name="ww_acc" value="" size="6" maxlength="6"
input type="submit" value="Login1"

I am unsure what command to use to instead of sendkeys.
Also,
After login I would like to copy the account web page data and paste/import it into a worksheet. I have tried several different aproaches put have failed so have stripped the macro back to the bare basics below:Sub colcreate()       Set ie = CreateObject("InternetExplorer.Application")    With ie           .Visible = False       .Navigate "o2r/LOGON.pgm"       Do Until Not .Busy       DoEvents       Loop              .Visible = False       Set ipf = ie.document.all.Item("ww_acc")       ipf.Value = "@" amp; (Range("B1").Value)       SendKeys "{ENTER}", True       Do Until Not .Busy       DoEvents       Loop              .Visible = True       .Navigate "o2r/ACCLIST.pgm?task=viewamp;ww_acc=" amp; (Range("B6").Value) amp; "amp;ww_branch=" amp; (Range("B7").Value)       Do Until Not .Busy       DoEvents       Loop  'need to copy the above page and paste text into excel        End With   End Sub

Any ideas?

For the first part take a look at submit, to well submit, ie logon, using the form.
The second part is probably more difficult.
It would really be dependent on the structure of the web page and/or what data you
want to retrieve.

Thank you for the reply, however I have taken a new approach.
I discovered the logon details are passed on via the ucl, so have managed duplicate this in my macro, which is pretty neat.
Copying the resulting web pages was tricky but I eventually used;
ie.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DONTPROMPTUSER
ie.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT
Unfortunately this brought across images and all sorts of objects as well as the text data I was after.
I found that if I paste all the data into a temporary worksheet I can identify the cells of info I want, select them as a range and copy/paste them into a new worksheet deleting the temporary worksheet and quiting IE when it was all done.
There is probably a more correct way of doing all this but my solution gets the job done.
Thanks again.
¥
Back Forum Reply New