+ Reply to Thread
Results 1 to 7 of 7

Excel macro that can open up a website and input a user name and password.

Hybrid View

glide2131 Excel macro that can open up... 05-09-2014, 07:55 PM
playaller Re: Excel macro that can open... 05-09-2014, 08:20 PM
playaller Re: Excel macro that can open... 05-09-2014, 08:42 PM
playaller Re: Excel macro that can open... 05-09-2014, 08:51 PM
glide2131 Re: Excel macro that can open... 05-09-2014, 08:57 PM
glide2131 Re: Excel macro that can open... 05-09-2014, 09:01 PM
playaller Re: Excel macro that can open... 05-09-2014, 09:10 PM
  1. #1
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Excel macro that can open up a website and input a user name and password.

    Uee this as the login url and it will work


    HTML Code: 
    Here is your updated code.

    Sub LoginToURL()
        Dim ie As Object, iebody As String, strURL As String, strUsername As String, strPassword As String
         
        Set ie = CreateObject("InternetExplorer.Application")
         
        strURL = "https://www.costar.com/PortalPublic/SSL/Login.aspx?c=30&LangType=1033"
        strUsername = "Username here"
        strPassword = "password here"
         
        ie.Navigate strURL
         'Wait until page is loaded.
        While ie.ReadyState < 4 ' READYSTATE_COMPLETE = 4
            DoEvents
        Wend
         
        ie.Visible = True
         
        ie.Document.All("username").Value = strUsername
        ie.Document.All("password").Value = strPassword
        ie.Document.All("oLoginButton").Click
         
         'Wait until page is loaded.
        While ie.ReadyState < 4 ' READYSTATE_COMPLETE = 4
            DoEvents
        Wend
         
        Application.Wait (Now + TimeValue("0:00:05"))
         
        iebody = ie.Document.body.innerhtml
         
        If InStr(iebody, "The information you entered is invalid.") <> 0 Then
            MsgBox "Login failed!", vbCritical + vbOKOnly
        Else
            MsgBox "Login successful!", vbInformation + vbOKOnly
        End If
         
        ie.Quit
        Set ie = Nothing
         
    End Sub
    Last edited by playaller; 05-09-2014 at 09:11 PM.


    Shelton A.
    If Helpful, Add Reputaion!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro that can open website and enter in username and password
    By glide2131 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-08-2014, 08:49 PM
  2. Open a website and input text in search box
    By gtg430i in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-30-2014, 06:20 PM
  3. Replies: 0
    Last Post: 10-02-2013, 01:47 AM
  4. Replies: 6
    Last Post: 02-09-2013, 03:06 AM
  5. Open (website) for Input?
    By Joey Lichtenstein in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2006, 11:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1