+ Reply to Thread
Results 1 to 2 of 2

CreateObject("InternetExplorer.Application")

  1. #1
    Registered User
    Join Date
    12-12-2005
    Posts
    13

    CreateObject("InternetExplorer.Application")

    This is the code so far:

    Please Login or Register  to view this content.
    I need to click on this link (it is the 20th link on hte page):

    Please Login or Register  to view this content.
    The problem? - The href changes everytime we log into the system, both before and after the forward-slash ("/"), I am pretty sure it is Yahoo's way of tracking the session.

    From recording macros I know that the link is in table 22, and that it is the second link in the table. Is there VBA for simply clicking on the link and then using the page it links to as the data source?

    I want to import a table on the page this link links to into excel as a data source, is there any other way to automate the table import?

    Thank You.
    Simon.
    Last edited by shart; 01-02-2006 at 05:56 AM.

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

    if you know the index of the link , you may try


    Sub declencherLienPageWeb()
    'Microsoft HTML Objects Library
    'Microsoft Internet Controls
    Dim IE As New InternetExplorer
    Dim Cible As HTMLAnchorElement
    Dim Doc As HTMLDocument

    IE.Navigate "http://www.webPage.html"
    IE.Visible = True
    Do Until IE.readyState = READYSTATE_COMPLETE
    DoEvents
    Loop

    Set Doc = IE.Document
    Set Cible = Doc.Links(20)

    Cible.Click
    End Sub



    to import the table , you could adapt this exemple


    Sub Importer_tableauPageWeb()
    Dim IE As InternetExplorer
    Dim maPageHtml As HTMLDocument
    Dim Htable As IHTMLElementCollection
    Dim maTable As IHTMLTable
    Dim j As Integer, i As Integer

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

    IE.navigate "http://www.webPage.html"
    Do Until IE.readyState = READYSTATE_COMPLETE
    DoEvents
    Loop

    Set maPageHtml = IE.document
    Set Htable = maPageHtml.getElementsByTagName("table") 'objet type table
    Set maTable = Htable(0) ' the first table

    For i = 1 To maTable.Rows.Length ' table rows

    For j = 1 To maTable.Rows(i - 1).Cells.Length ' each cell of the row
    Cells(i, j) = maTable.Rows(i - 1).Cells(j - 1).innerText
    Next j

    Next i
    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