none
HTTP Request, to pre enter username and password to pass the log-in screen automatically to collect information from the required page and use it aws a tooltip for the required hyperlink. RRS feed

  • Question

  • Sub http() Dim MyRequest As Object Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1") MyRequest.Open "GET", _ "http://www.google.com" ' Send Request. MyRequest.Send 'And we get this response MsgBox MyRequest.ResponseText End Sub

    The above is My first attempt at simply collecting information and displaying the HTML code within the HTML page but it never let me bypass the login screne even when i was activley logged in a browser, I need to do this in order to extract a header from tehw ebpage and apply it to a tooltip. Below is my next attempt at attempting to use a login function to authtenicate and let me bypass the log-in screen.

    Sub HTML_Element_Printer()
    
    On Error GoTo Err_Clear
    sURL = "www.google.com"
    Set oBrowser = New InternetExplorer
    oBrowser.Silent = True
    oBrowser.timeout = 60
    oBrowser.navigate sURL
    oBrowser.Visible = True
    
    Do
    ' Wait till the Browser is loaded
    Loop Until oBrowser.readyState = READYSTATE_COMPLETE
    
    Set HTMLDoc = oBrowser.Document
    
    HTMLDoc.all.loginID.Value = "exampleusername"
    HTMLDoc.all.Password.Value = "examplepassword"
    
    For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
    Debug.Print oHTML_Element.Name
    Next
    
    ' oBrowser.Refresh ' Refresh If Needed
    Err_Clear:
    If Err <> 0 Then
    Err.Clear
    Resume Next
    End If
    End Sub
    This also didnt work and am not sure why I think it might be something to do with the wrong ID's being sleected but when i change the ID's to the correct ones it doesnt work for me again.

    TL;DR- Need to Bypass login screen by pre entering usename and password, from there on the page I wont to get to extract a header/title and allow it to be used as a tooltip for a hyperlink. Also this is in VBA, I Presume I can use this code in excel,word and outlook.

    Please Help I have been stuck on this for a while now.

    Many Thanks.


    Monday, November 4, 2013 8:30 AM