Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Web Query for a password protected website
Thanks Thanks: 0 Likes Likes: 0

  1. #11
    New Member
    Join Date
    Nov 2012
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Web Query for a password protected website

    Hi, may I know the URL of the website you want to login? I can help you. I have a set of code which can login.

  2. #12
    New Member
    Join Date
    Nov 2012
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Web Query for a password protected website

    The code is the one you recommended on Nov. 22nd; here's the link:

    Daily Dose of Excel Blog Archive Get Data from Website that Requires a Login

    The code that I am trying to run is:
    (I've changed the log on info to "fake" to protect the innocent.)

    Public Sub WebQuery()
    Const READYSTATE_COMPLETE As Long = 4
    Dim x As Integer

    URL = "https://www.retireonline.com/rpsparticipant/index.jsp"
    Set ie = Sheet1.WebBrowser1 ' ???how to define WebBrowser1??
    ie.Visible = 1
    DoEvents
    ie.Navigate URL
    Do Until ie.readystate = READYSTATE_COMPLETE
    DoEvents
    Loop

    With ie.Document.login

    .USER.Value = "fake"
    .Password.Value = "fake"
    .submit
    End With


    Do Until ie.readystate = READYSTATE_COMPLETE
    DoEvents
    Loop
    Application.Wait Now + TimeValue("00:00:03")
    HTMLdata = Sheet1.WebBrowser1.Document.DocumentElement.innertext
    HTMLdata = VBA.Split(HTMLdata, Chr(13)) 'change the split as required CHR(13) is for carriage return.
    For x = 0 To UBound(HTMLdata)
    Sheet1.Range("A" & (x + 1)) = HTMLdata(x)
    Next x

    End Sub

  3. #13
    New Member
    Join Date
    Nov 2012
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Web Query for a password protected website

    JK, The code is the one you recommended on Nov 22:


    Daily Dose of Excel Blog Archive Get Data from Website that Requires a Login

    Here's a list of the modified code that I'm trying to run:
    Public Sub WebQuery()
    Const READYSTATE_COMPLETE As Long = 4
    Dim x As Integer

    URL = "https://www.retireonline.com/rpsparticipant/index.jsp"
    Set ie = Sheet1.WebBrowser1 ' ???how to define WebBrowser1??
    ie.Visible = 1
    DoEvents
    ie.Navigate URL
    Do Until ie.readystate = READYSTATE_COMPLETE
    DoEvents
    Loop

    With ie.Document.login

    .USER.Value = "fake"
    .Password.Value = "fake"
    .submit
    End With


    Do Until ie.readystate = READYSTATE_COMPLETE
    DoEvents
    Loop
    Application.Wait Now + TimeValue("00:00:03")
    HTMLdata = Sheet1.WebBrowser1.Document.DocumentElement.innertext
    HTMLdata = VBA.Split(HTMLdata, Chr(13)) 'change the split as required CHR(13) is for carriage return.
    For x = 0 To UBound(HTMLdata)
    Sheet1.Range("A" & (x + 1)) = HTMLdata(x)
    Next x

    End Sub

  4. #14
    New Member
    Join Date
    Nov 2009
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Web Query for a password protected website

    This video shows how it isn't a reference but rather an object.
    Web Browser Control in Microsoft Excel 2007 VBA - YouTube

  5. #15
    New Member
    Join Date
    Jan 2014
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Web Query for a password protected website

    What if the "Microsoft Web Browser" is not listed in the references? (including Microsoft Active X...WB, MS WB, Microsoft Office WB, or just WB spellings)? I have made a brief search on web an cannot find it.

  6. #16
    Board Regular jkpieterse's Avatar
    Join Date
    Dec 2007
    Location
    Weert
    Posts
    894
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Web Query for a password protected website

    It is not in references, you must right-click the control toolbox of a userform and select "More controls". There you will find the Microsoft web browser control. If it isn't there: Are you on a MAC?
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  7. #17
    New Member
    Join Date
    Jan 2014
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Web Query for a password protected website

    Quote Originally Posted by jkpieterse View Post
    It is not in references, you must right-click the control toolbox of a userform and select "More controls". There you will find the Microsoft web browser control. If it isn't there: Are you on a MAC?
    No, but neither am I using a userform... Also, I am using Mozilla Firefox not IE, though I have IE installed.

  8. #18
    Board Regular jkpieterse's Avatar
    Join Date
    Dec 2007
    Location
    Weert
    Posts
    894
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Web Query for a password protected website

    In that case you need the Microsoft Internet Controls library. I don't think you can automate Firefoxz from VBA, but you may prove me wrong
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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