+ Reply to Thread
Results 1 to 8 of 8

How to GetValue <span id="lastOddsRefreshTime"> pls help !!!!

  1. #1
    Registered User
    Join Date
    09-06-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    How to GetValue <span id="lastOddsRefreshTime"> pls help !!!!

    I try below , but cannot work, pls help !!!!

    - Table Query
    - CreateObject("MSXML2.XMLHTTP")
    - CreateObject("WinHttp.WinHttpRequest.5.1")


    http://bet.hkjc.com/football/results...=73658&lang=en

    Get value :

    <span id="lastOddsRefreshTime"> ~~~~> 20/09/2013 12:32 get to Range("A1")
    Last edited by thiskeep; 09-21-2013 at 10:39 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How to GetValue <span id="lastOddsRefreshTime"> pls help !!!!

    Hello thiskeep,

    Welcome to the Forum!

    This will extract the last refresh time and save in the variable "Data".
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    09-06-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to GetValue <span id="lastOddsRefreshTime"> pls help !!!!

    Thanks to your response.
    coz...... variable Data so I cannot get.
    I have no experience to one by one to get external file between create,call label from file at the same time.
    How about another option that not necessary create HTMLdoc to get it even once shot source code into excel and it can be find feasible. PLEASE HELP.....

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How to GetValue <span id="lastOddsRefreshTime"> pls help !!!!

    Hello thiskeep,

    The code has the URL that you posted included in it. Whenever the macro is run it will retrieve the most current value of the "Last Odds". Do you need a workbook with the macro installed? How often does this information need to be retrieved?

  5. #5
    Registered User
    Join Date
    09-06-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to GetValue <span id="lastOddsRefreshTime"> pls help !!!!

    Thanks to your response.
    The refresh time supposed be last time. Only for backup purpose, please see attached file. vbaresult.xls
    I know how to get other data, however the <span id="lastOddsRefreshTime"> is manual input, cannot to get it by ".iqy file".
    I learning to try your method to call the data from "HTMLdoc.getElementsBytagName" , but I'm fresh vb, need to long time to study RENEW edit whole macro processing.( get data from simple iqy changed MSXML2.XMLHTTP).

  6. #6
    Registered User
    Join Date
    09-06-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to GetValue <span id="lastOddsRefreshTime"> pls help !!!!

    Please Login or Register  to view this content.
    After studied few hours, I can take the time data ,
    but iexplore.exe cannot to closed in System Idle Process, often busy waiting.... also need manual to close iexplore for run two times.

  7. #7
    Registered User
    Join Date
    09-06-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to GetValue <span id="lastOddsRefreshTime"> pls help !!!!

    Dim HTMLdoc As HTMLDocument
    '''''Microsoft HTML Object Library

    Dim IE As InternetExplorer
    '''''Microsoft Internet Controls ((((( name = Microsoft Browser Helpers " changed ? " )))))

    '''''Microsoft XML, v6.0 ''''''MSXML2.XMLHTTP60
    '''''C:\WINDOWS\system32\msxml6.dll
    Dim IE As MSXML2.XMLHTTP60
    Set IE = New MSXML2.XMLHTTP60

    IE.Open "GET", "http://www. ", False
    IE.send

    While IE.ReadyState <> 4
    DoEvents
    Wend

    Dim HTMLDoc As MSHTML.HTMLDocument
    Dim HTMLBody As MSHTML.htmlBody

    Set HTMLDoc = New MSHTML.HTMLDocument
    Set HTMLBody = HTMLDoc.body
    HTMLBody.innerHTML = IE.responseText

    May be changed to Microsoft XML 6.0.......................

  8. #8
    Registered User
    Join Date
    09-06-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: How to GetValue <span id="lastOddsRefreshTime"> pls help !!!!

    Sub RefreshTime()
    Dim IE As Object
    Dim URL As String
    Dim LASTtime As Object
    Set S1 = Sheets("Sheet1")
    getRow = S1.Cells(S1.Rows.Count, 1).End(xlUp).Row
    For getlink = 2 To getRow
    URL = S1.Cells(getlink, 1).Value

    Set IE = CreateObject("InternetExplorer.Application")
    With IE
    .navigate URL
    Do While .Busy Or .readyState <> 4
    DoEvents
    Loop

    Set LASTtime = .document.getElementById("lastOddsRefreshTime")
    S1.Cells(getlink, 2).Value = LASTtime.innerText

    .Quit
    End With
    Next
    End Sub

    ://bet.hkjc.com/football/results/last_odds.aspx?lang=CH&id=73658 20/09/2013 02:08
    ://bet.hkjc.com/football/results/last_odds.aspx?lang=CH&id=73659 20/09/2013 06:27
    ://bet.hkjc.com/football/results/last_odds.aspx?lang=CH&id=73660 20/09/2013 07:40

    I can get the data from getElementById instead byTagName. and also stoped ALL Add-ons feature in IE to solve iexplore.exe hanging problems.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using GetOpenFilename with the GetValue function
    By mike679 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-10-2012, 06:46 PM
  2. Same year span for each name
    By NTB in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-27-2011, 10:41 AM
  3. GetValue to extract data from closed files
    By John James in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-08-2006, 06:19 AM
  4. [SOLVED] Using the Getvalue Function & ExecuteExcel4Macro
    By solidunity in forum Excel General
    Replies: 2
    Last Post: 07-12-2005, 04:05 PM
  5. Re: Using the Getvalue Function & ExecuteExcel4Macro
    By solidunity in forum Excel General
    Replies: 0
    Last Post: 07-12-2005, 12:05 PM

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