Results 1 to 2 of 2

Thread: How do you retrieve text from html element?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    Off the top of my head and it hasn't been tested:

    Dim strTable As String, intI As Integer, intJ As Integer, intFreeFile As Integer

    intFreeFile = FreeFile
    Open "htmlpage.html" for input As #intFreeFile

    dim strTags() as string

    redim strTags(2)

    strTags(1) = "<table"
    strTags(2) = "</table"
    'put the tags you want to search for in the array.

    do until EOF(intFreeFile)

    Line Input #intFreeFile, strLine

    inti = instr(strLine, strTags(1)
    'this would get location of "<table"

    'I'm not exactly sure how you would want to procced.
    intj = intstr(strLine, strTags(2)

    if intJ <> 0 then 'found
    'strTable will hold everything up to this
    'can do what ever you want with this variable
    'it will get reset each loop
    strTable = ""
    elseif intI <> 0 and intJ = 0
    strTable = strTable & mid(strline, inti)
    'this would grab everything from the <table on
    elseif intI = 0 and intJ = 0
    'the begining tag not found, don't do anything
    end if
    loop


    This would (I hope) give you the location of the begining of the table (inti) and then end of the table (intJ) -It would move through lies until you find intJ - copying the strline into a variable until you do. Then you'd have all that tables info.

    I know this isn't perfect and i probably made syntax errors but the basic idea should work. I'm on my lunch break and just about going to a meeting so had to make it fast. Hope it helps.

    ------------------
    'cos Buzby says so!'

  2. #2
    New Member
    Join Date
    Feb 2000
    Location
    Parsippany, NJ
    Posts
    1

    Post

    I need to retrieve specific text with in a table. I can retrieve the first table but how do I retrieve a table afterwards, the only unique attribute about the table is its border, however i don't know if that will remain constant. I have tried to loop through the tags using a for and setting a variant equal to the table tag, but i can't passed the first encounter, please give best general advice!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width