Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks,
that is precisely what i was looking for!!! Dave "Jake Marx" wrote in message ... Hi Dave, The following function will take a URL, a start string (in your case, pass in "<!--StartTag--"), and an end string ("<!--EndTag--") and will retun the HTML source inbetween them. If you want the actual text displayed on the screen, then you can change InnerHTML to InnerText, but you will have to use 2 visible text strings (not HTML comments) as the start and end arguments. Public Function gsGetString(rsURL As String, _ rsStartHTML As String, rsEndHTML As String) As String Dim ie As Object Dim sHTML As String Dim lStartPos As Long Dim lEndPos As Long Set ie = CreateObject("InternetExplorer.Application") With ie .Navigate rsURL Do Until Not .Busy And .ReadyState = 4 DoEvents Loop sHTML = .Document.Body.InnerHTML End With ie.Quit Set ie = Nothing lStartPos = InStr(1, sHTML, rsStartHTML, vbTextCompare) If lStartPos Then lStartPos = lStartPos + Len(rsStartHTML) lEndPos = InStr(lStartPos, sHTML, rsEndHTML, vbTextCompare) If lEndPos Then lEndPos = lEndPos - 1 gsGetString = Mid$(sHTML, lStartPos, lEndPos _ - lStartPos + 1) End If End If End Function -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Daveed wrote: Hi, I am trying to perform a webquery that grabs specific data from a page. I want to grab only the data between two specific tags "<!--StartTag--" and "<!--EndTag--" Is there any way to do this? The webquery built into excel does not seem to allow for this kind of specific parsing. Any help would be appreciated. thanks, dave |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Import New Database Query (Union Query) in Spreadsheet | Excel Discussion (Misc queries) | |||
Convert hard coded query criteria to Parameter Query | Excel Discussion (Misc queries) | |||
Excel 2007 / MS Query - editing existing query to another sheet | Excel Discussion (Misc queries) | |||
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? | Excel Discussion (Misc queries) | |||
How to use a Access Query that as a parameter into Excel database query | Excel Discussion (Misc queries) |