Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Web Query. Log on Username & Password

  1. #1
    Join Date
    5th February 2003
    Posts
    8

    Web Query. Log on Username & Password

    Hello to all , as you can see in the code below, I need :
    1) navigate to a web page
    2) submit my userId and password
    3) beeing redirected to a different url I have to menage this situation for passing url to
    4) quering sub
    I am using Excel 2000 with win98
    Error 429 Can't create object:which one?please help
    VB:
    Public Sub First() 
        Dim obEx As Object 
        Dim obj As New MSHTML.HTMLBody 
        Dim strPass As String 
        Dim elUid As New MSHTML.HTMLInputElement 
        Dim elPass As New MSHTML.HTMLInputElement 
        Dim elSubmit As New MSHTML.HTMLInputElement 
        Dim strUid As String 
        Dim Desc As String 
         
        strUid = "something" 'UserID
        strPass = "something" 'my password
         
        On Error Goto HandleError 
        Set obEx = CreateObject("InternetExplorer.Application") 
         
        With obEx 
            .navigate "http://registrazioni.directaworld.it/quotazioni/index.php3" 'Main URL
             
            Do While .Busy: DoEvents: Loop 
                Do While .readyState <> 4: DoEvents: Loop 
                     
                    Set obj = obEx.document.body 
                     'Now submit UserId,Password and click submit
                    Set elUid = obj.getElementsByTagName("INPUT").Item("u") 
                    elUid.Value = strUid 
                    Set elPass = obj.getElementsByTagName("INPUT").Item("p") 
                    elPass.Value = strPass 
                    Set elSubmit = obj.getElementsByTagName("INPUT").Item("Submit") 
                    elSubmit.Click 
                     'Loop until IE is redirect to URL to query which I Know partially
                    Do While Not CBool(InStrB(1, .LocationURL, _ 
                        "start.php?t=00007275")) 
                        DoEvents 
                    Loop 
                     
                    Do While .Busy: DoEvents: Loop 
                        Do While .readyState <> 4: DoEvents: Loop 
                             
                        End With 
                        Desc = obEx.LocationURL 'URL to Query
                        Call Connetti(Desc) 
                         
                        obEx.Quit 
                        Set obEx = Nothing 
                        Set obj = Nothing 
                         
    HandleExit: 
                         
                        Exit Sub 
                         
    HandleError: 
                        obEx.Quit 
                        Set obEx = Nothing 
                        Set obj = Nothing 
                        ErrorHandle Err, Erl(), "Module1.First" 
                        Resume HandleExit 
                    End Sub 
    
    
    Thanks

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    7th December 2005
    Location
    Hampshire, England
    Posts
    4,898

    Re: Connecting the web for querying

    Please don't use tags in thread titles.

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    5th February 2003
    Posts
    8

    Re: Connecting the web for querying

    I saw it only when I posted,I apologize it,sorry, it is the first post for me,regards,Giogugio

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    7th December 2005
    Location
    Hampshire, England
    Posts
    4,898

    Re: Connecting the web for querying

    OK, no problem.

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,708

  6. #6
    Join Date
    5th February 2003
    Posts
    8

    Re: CreateObject. Can't Create Object

    Thanks Dave;I was not able to retrieve that help in MS site
    When I debugged the sub on my computer it seemed to me that it was fine

    Excel Video Tutorials / Excel Dashboards Reports


  7. #7
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,708

    Re: CreateObject. Can't Create Object

    Please stop using Bold on all your posts.

    Don't know what you mean by "not able to retrieve". Link is fine.

  8. #8
    Join Date
    5th February 2003
    Posts
    8

    Re: CreateObject. Can't Create Object

    Now It works , if someone is interested : I will post.
    Regards

    Excel Video Tutorials / Excel Dashboards Reports


  9. #9
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,708

    Re: CreateObject. Can't Create Object

    Yes please, always share any solutions in keeping with the spirit of the forum.

  10. #10
    Join Date
    5th February 2003
    Posts
    8

    Re: CreateObject. Can't Create Object

    I hope it will be usefull . I am learning so I have some scruple to post code.
    VB:
    Public Sub WebAccess() 
        Dim strUid As String 'UserID
        Dim strPass As String 'Password
        Dim strQueryURL As String 'URL to query
        Dim objIE As New SHDocVw.InternetExplorer 
        Dim htmlDoc As MSHTML.HTMLDocument 
        Dim htmlInput As MSHTML.HTMLInputElement 
        Dim htmlColl As MSHTML.IHTMLElementCollection 
        Dim testing As String 
         
         
        strUid = "YourId" 
        strPass = "YourPass" 
         
        Set objIE = CreateObject("InternetExplorer.Application") 
         
        With objIE 
            .navigate "Your URL" 'Main URL
            Do While .Busy: DoEvents: Loop 
                Do While .readyState <> 4: DoEvents: Loop 
                     
                    Set htmlDoc = .document 
                    Set htmlColl = htmlDoc.getElementsByTagName("INPUT") 
                     
                     
                    For Each htmlInput In htmlColl 
                        If htmlInput.Name = "Itsname" Then htmlInput.Value = strUid 
                        If htmlInput.Name = "Itsname" Then htmlInput.Value = strPass 
                    Next htmlInput 
                    For Each htmlInput In htmlColl 
                        If htmlInput.Name = "Itsname" Then 
                            htmlInput.Click 
                            Exit For 
                        End If 
                    Next htmlInput 
                    Do While .Busy: DoEvents: Loop 
                        Do While .readyState <> 4: DoEvents: Loop 
                             
                        End With 
                        strQueryURL = objIE.LocationURL 
                        Call ConnettionSUB(strQueryURL) 
                         
                         
                        Set htmlDoc = Nothing 
                        objIE.Quit 
                        Set objIE = Nothing 
                    End Sub 
    
    
    Regards

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. SQL Database On Server Prompts For UserName & Password
    By sandyshaw in forum Excel and/or SQL Help
    Replies: 6
    Last Post: August 6th, 2010, 15:54
  2. Automate Username & Password Log In To Web Page
    By grim sleeper in forum EXCEL HELP
    Replies: 3
    Last Post: November 21st, 2007, 07:35
  3. Enter Username & Password On Web Page
    By amirampeled in forum EXCEL HELP
    Replies: 4
    Last Post: October 25th, 2007, 03:13
  4. Replies: 15
    Last Post: February 1st, 2005, 17:44
  5. VBA : Passing Username and Password for website
    By tudor30 in forum EXCEL HELP
    Replies: 3
    Last Post: March 26th, 2004, 22:13

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
  •  
porno