This is not strictly excel, but I am running it from an excel macro

D

Dave F.

Hi

I anyone knows a better NG to get an answer, please let me know.

Anyway... I'm trying to load a password protected web page:

http://extranet.4projects.com/

This is as far as I've got:

Sub Projects_4()
Dim oIE As New SHDocVw.InternetExplorer

Set oIE = New SHDocVw.InternetExplorer
oIE.Navigate "http://extranet.4projects.com/ "
Do Until Not oIE.Busy
DoEvents
Loop
oIE.Document.all("Login").Click
Do Until Not oIE.Busy
DoEvents
Loop
oIE.Visible = True
oIE.Document.all("txtpassword").Value = "password" ' This gives an "object
not set" etc. error
End Sub

The Login button displays a popup which I've no idea how to 'grab hold of'
to pass the password/login info.
The oIE variable still contains the original web page object.

The Source should give me some clues, but I haven't a clue.

Any help would be greatly appreciated.

Cheers

Dave F.
 
T

Tim Williams

Dave,

If you have the login page up then this will log you in. No idea
what's next, since I wasn't able to log in myself.. ;-)

Tim.


Sub LogMeIn()
Dim o As Object

Set o =
GetHTMLDocument("http://extranet.4projects.com/popuplogin.asp?")

If Not o Is Nothing Then
o.getElementById("txtLogin").Value = "username"
o.getElementById("txtpassword").Value = "password"
o.getElementById("submit1").Click
End If

End Sub

'Find an IE window with matching location and get the document from
' the loaded page. Assumes no frames.
Function GetHTMLDocument(sAddress As String) As Object

Dim objShell As Object, objShellWindows As Object, o As Object
Dim retVal As Object, sURL As String

Set retVal = Nothing
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows

For Each o In objShellWindows
sURL = ""
On Error Resume Next
sURL = o.Document.Location
On Error GoTo 0
If sURL <> "" Then
If sURL Like sAddress & "*" Then
Set retVal = o.Document
Exit For
End If
End If
Next o

Set GetHTMLDocument = retVal
End Function
 

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