Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login to website??? 1

Status
Not open for further replies.

LJA520

Programmer
Nov 3, 2003
65
US
Hello!

With vba I am trying to automate the process of logging into a website, navigate through it and dowload a file. I am currently using msINET.ocx. My first problem is that I cannot login. I have been looking at the html trying to see if I have to pass in something, but I am really confused.

Does anyone know how to do this, or have any idea's on the best way to do this?

THANK YOU!!!!!!
 
Sub Read_URL_Test()

With ActiveSheet.QueryTables.Add(Connection:="URL; _
Destination:=Range("a1"))'write web-page to sheet

.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With
End Sub
 
Thanks, ETID! I'll have to read up on that. Any tips or tricks you'd care to pass along?

Have a great day!

j2consulting@yahoo.com
 
Thanks for your response, although... I have started using the InternetExplorer object, (shdocvw.dll) and I am able to login to a website (yahoo.com) because I looked at the html and found the textboxes in the code.

BUT... I need to login to a different website and in the html it has some things hidden, and I think it's calling a function to set the login/password, but I can't see them.... does anyone know how to find that function or pass in something?

Thanks in advance!!!
 
LJ,

I don't know if this will help but I get on to the net using the Shell command then I use send keys. Probably not the best way but it works for me.

Good Luck

I know a little about nothing and even less about everything.
 
Hello ribhead,

Would you mind posting a bit of code illustrating what you said in your post. I'd like to try that but I'm not sure what I should be doing. Thanks!
 
Hey WantsToLearn,

Here is what I do sometimes I'm sure this isn't the best practice.

Sub OnInternet()
Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE espn.com", vbMaximizedFocus
Application.Wait Now + TimeValue("00:00:05") 'Waiting for internet to load
Application.SendKeys "%F", True
Application.SendKeys "{DOWN 12}", True
Application.SendKeys "{UP 12}", True
Application.SendKeys "{ESCAPE}"
Application.SendKeys "%{F4}"
End Sub

rib

I know a little about nothing and even less about everything.
 
Hi LJA520,

There are 2 different ways that a username/password form can be passed to the server, (the POST or GET method), both can be automated using either the msinet.ocx or the shdocvw.dll. (I find the shdocvw.dll easier to work with.)

If you could post the url of the site you're trying to automate or a url that has a similar type login, I should be able to help.

Steve
 
Thanks ribhead!

sfvb,

I know I will be needing to do that soon, is there some generic code you could post as a learning example. Thanks!
 
WantsToLearn,

Just look at the Help file(f1) if you have it available there are some examples of it in there. Remember I am in no way an MVP of any forum. The dudes that are on here like skip, Tony, xlbo,bowers 74, and VBA jedi are the real deal and 99.9999999% of the time if they don't have the answer then it can't be done. If I can help anyone I will but the last thing I want to do is give someone poor programming methods. I'm not trying to sound like I don't want to help just look at my stuff as a possiblity and make sure you listen to the MVPs.

rib

P.S. If you don't have the help file I will post some generic examples for you.

Thanks head

I know a little about nothing and even less about everything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top