Enter Username & Password into pop-up window on Web Page

j844929

Active Member
Joined
Aug 18, 2002
Messages
423
Hi,

I have successfully entered Usernames and Passwords into all sorts of websites, but I'm a bit stuck on this one. When you navigate to the URL, A pop-up window appears asking for a Username and Password entry. I have tried the following, but it didn't work and now I'm left scratching my head. The URL is provided in the code.

Code:
Sub Login_To_Website()
Set myIE = CreateObject("InternetExplorer.Application")
myIE.Navigate URL:="https://www.toga.ngtuk.co.uk/toga"

On Error Resume Next
AppActivate "Connect to www.toga.ngtuk.co.uk", 1
 
           Do Until .ReadyState = 4
            DoEvents
        .Visible = True
            With .Document.forms("Connect to www.toga.ngtuk.co.uk")
                .USER.Value = "Username"
                .Password.Value = "Password"
                .submit
            End With

End Sub

[code]

Can anyone provide a solution that actually works?

Any help on this would be greatly appreciated.

Tim
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,622
The pop-up login window isn't a HTML form, so setting and submitting the form fields won't work.

This type of pop-up window is displayed in response to user name and password authentication required by the web server. You could try the technique shown in http://www.mrexcel.com/forum/showthread.php?t=442354 (last code posted is the best).

Failing that, using FindWindow and probably other functions from the Windows API to find and populate each part of the login window (user name input field, password input field, OK button) might work.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,258
Messages
5,600,567
Members
414,389
Latest member
MarkElla

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top