Automating Internet Explorer

G

Guest

I have this lovely code I got from The Access Web (Thanks Dev!):

Sub TestHTTP()
On Error GoTo ErrHandler
Dim objHTTP As HTTP
Const conTARGET =
"http://www.company.com/cvd/Group/GroupProfile.aspx?grp=01130&sys=1"

Set objHTTP = New HTTP
With objHTTP
.HttpURL = conTARGET
.DestinationFile = "c:\temp\test1.htm"
.PromptWithCommonDialog = False
If .FileExists Then .OverwriteTarget = True
If Not .IsConnected Then .DialDefaultNumber
.ConnectToHTTPHost
.WriteHTTPDataToFile
End With
ExitHere:
On Error Resume Next
Set objHTTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
ErrHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub


This is a website that I have to login to. So, where it says

Set objHTTP = New HTTP

I need it to use the open Internet Explorer window, not create a new one. I
get a 'You are not logged in' page everytime.

I have tried
Set objHTTP = Current HTTP
Set objHTTP = Existing HTTP
etc to no avail.

I have 407 internet pages to download and parse in Excel.

Any help is greatly appreciated!

Thanks!
Laura
 
D

Dirk Goldgar

Laura said:
I have this lovely code I got from The Access Web (Thanks Dev!):

Sub TestHTTP()
On Error GoTo ErrHandler
Dim objHTTP As HTTP
Const conTARGET =
"http://www.company.com/cvd/Group/GroupProfile.aspx?grp=01130&sys=1"

Set objHTTP = New HTTP
With objHTTP
.HttpURL = conTARGET
.DestinationFile = "c:\temp\test1.htm"
.PromptWithCommonDialog = False
If .FileExists Then .OverwriteTarget = True
If Not .IsConnected Then .DialDefaultNumber
.ConnectToHTTPHost
.WriteHTTPDataToFile
End With
ExitHere:
On Error Resume Next
Set objHTTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
ErrHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub


This is a website that I have to login to. So, where it says

Set objHTTP = New HTTP

I need it to use the open Internet Explorer window, not create a new
one. I get a 'You are not logged in' page everytime.

I have tried
Set objHTTP = Current HTTP
Set objHTTP = Existing HTTP
etc to no avail.

I have 407 internet pages to download and parse in Excel.

Any help is greatly appreciated!

Thanks!
Laura

You can't make Dev's HTTP class use an existing explorer window, because
it doesn't actually use Internet Explorer at all. However, I have
modified the class to allow you to specify a userID and password, if you
need to access a web site that has restricted permissions. Note that
this would be for a site where IE itself prompts you to log in, not for
some site that puts up its own login form. Is that what you're dealing
with? If so, I could send you my version of the class, and you could
see if it works for you.
 
G

Guest

Yes, I'm dealing with a site with it's own login form.

I really, really appreciate your help.

Thanks,
Laura
 
D

Dirk Goldgar

Laura said:
Yes, I'm dealing with a site with it's own login form.

I really, really appreciate your help.

I'm afraid you're not going to appreciate it so much when I tell you
that I don't thinkg my modified version of the class will help in such a
case. I was talking about the situation where you were dealing with a
web site to which access is restricted directly by the web server. If I
understand you, you're dealing with a site that presents its own HTML
login form, which is a different matter.

I'm not sure how best to handle this situation. Maybe you can use the
Microsoft Web Browser ActiveX control instead, initially entering the
login information manually, and then manipulating the control
programmatically. I haven't done anything much with it, though.
 
A

Alp

Hi Dirk,

If you won't mind, I could use that code for my update download page and
would thank you for it.

Sincerely,

Alp
 
D

Dirk Goldgar

Alp said:
Hi Dirk,

If you won't mind, I could use that code for my update download page
and would thank you for it.

E-mail me with a valid reply address, and I'll send it to you. To
e-mail me, you'll have to remove NO SPAM from the reply address of this
message.

Can I take it that you've already got Dev & Terry's Internet Transfer
Library code, as originally posted on the Access Web?, so all you need
is the version of the HTTP class with my small modifications?
 
A

Alp

Thank you Dirk. Email is sent.

Alp

Dirk Goldgar said:
E-mail me with a valid reply address, and I'll send it to you. To
e-mail me, you'll have to remove NO SPAM from the reply address of this
message.

Can I take it that you've already got Dev & Terry's Internet Transfer
Library code, as originally posted on the Access Web?, so all you need
is the version of the HTTP class with my small modifications?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dirk Goldgar

Laura said:
I have this lovely code I got from The Access Web (Thanks Dev!):

Sub TestHTTP()
On Error GoTo ErrHandler
Dim objHTTP As HTTP
Const conTARGET =
"http://www.company.com/cvd/Group/GroupProfile.aspx?grp=01130&sys=1"

Set objHTTP = New HTTP
With objHTTP
.HttpURL = conTARGET
.DestinationFile = "c:\temp\test1.htm"
.PromptWithCommonDialog = False
If .FileExists Then .OverwriteTarget = True
If Not .IsConnected Then .DialDefaultNumber
.ConnectToHTTPHost
.WriteHTTPDataToFile
End With
ExitHere:
On Error Resume Next
Set objHTTP = Nothing
Call SysCmd(acSysCmdRemoveMeter)
Exit Sub
ErrHandler:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub


This is a website that I have to login to. So, where it says

Set objHTTP = New HTTP

I need it to use the open Internet Explorer window, not create a new
one. I get a 'You are not logged in' page everytime.

I have tried
Set objHTTP = Current HTTP
Set objHTTP = Existing HTTP
etc to no avail.

I have 407 internet pages to download and parse in Excel.

Any help is greatly appreciated!

Thanks!
Laura

Laura -

I just came across this:

http://www.mvps.org/access/api/api0051.htm
Read/Set Internet Explorer URL from code

It looks like it may be just the thing you're looking for. I don't know
if you'll see this message, so long after your original post, but I can
hope.
 

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

Similar Threads


Top