Results 1 to 7 of 7

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

Threaded 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
    Forum Contributor
    Join Date
    04-30-2013
    Location
    arizona
    MS-Off Ver
    365
    Posts
    147

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

    Hello,
    I am having trouble finding code that will work with this website.
    I found the following code but it keeps opening the website and giving me the following error message: "Object variable or With block variable not set"
    can any one help me? I would also perfer to use chrome instead of IE if possible.
    Thanks,

    Sub LoginToURL()
        Dim ie As Object, iebody As String, strURL As String, strUsername As String, strPassword As String
         
        Set ie = CreateObject("InternetExplorer.Application")
         
        strURL = "http://www.costar.com/"
        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("sign-in-button").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 glide2131; 05-09-2014 at 09:02 PM.

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