+ Reply to Thread
Results 1 to 2 of 2

How can I navigate throw multiple Web pages...

  1. #1
    Luc Dansereau
    Guest

    How can I navigate throw multiple Web pages...

    Hi,

    From Excel, how can I naviguate throw multiple Web pages depending on the
    answer of the user.
    Example:
    If the user answers Yes to a question,
    I want to automatize this process:
    bring the user to a specific web page (www.test.com)
    on this page, select the first choice on a scrolling
    list
    click "Continue"
    Then view this page

    If the user answers No the same question,
    I want to automatize this process:
    bring the user to a specific web page (www.test.com)
    on this page, select the second choice on the same
    scrolling list option
    click "Continue"
    Then view this page

    Is it possible ???

    Thank you very much for your help

    Luc



  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello Luc

    this example open the ExcelTip page . if you click on "Yes" , it select the index "Excel formula and function" in the scrolling list "Categorie" , if you click on "No" it select "Excel macros and VBA" and then release the button "Find tip"

    in your project , you will have to determine the index of the scrolling list and the buttons
    I hope this help you


    Sub navigateWebPage_FromExcel()
    'activer la reference Microsoft HTML Objects Library
    'activer la reference Microsoft Internet Controls
    Dim IE As InternetExplorer
    Dim maPageHtml As HTMLDocument
    Dim Hsel As IHTMLElementCollection, Helem As IHTMLElementCollection
    Dim Reponse As String

    Reponse = MsgBox("Do you prefer Formulas than VBA ? ", vbYesNo, "Select a category ")

    Set IE = CreateObject("InternetExplorer.Application")
    IE.Visible = True

    IE.navigate "http://www.exceltip.com/"
    Do Until IE.readyState = READYSTATE_COMPLETE
    DoEvents
    Loop

    Set maPageHtml = IE.document
    Set Hsel = maPageHtml.getElementsByTagName("select")

    If Reponse = vbYes Then
    '0 for the first scrolling list in the web page
    '4 for the index you select in the scrolling list
    Hsel(0).selectedIndex = 4 'formulas
    Else
    Hsel(0).selectedIndex = 6 'vba
    End If

    Set Helem = maPageHtml.getElementsByTagName("input")
    Helem(5).innerText = "Excel" 'keywords ( just for the example )
    Helem(6).Click '"Find Tip" button

    End Sub



    Regards
    michel

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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