Results 1 to 13 of 13

Thread: Read web page dynamically (Solved)

Threaded View

  1. #9
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Read web page dynamically

    This will parse out the td tag after the tag containing U Case as it's text
    Code:
    Private Sub Command1_Click()
    Dim strURL As String
    Dim objHTML
    Dim intPos As Integer
    Dim strHTML As String
    
    
        strURL = "C:\Documents and Settings\Mark\Desktop\Confirm\Confirm.htm"
        Set objHTML = CreateObject("Microsoft.XMLHTTP")
        objHTML.open "GET", strURL, False
        objHTML.send
        
        strHTML = objHTML.responseText
        Set objHTML = Nothing
        
        
        'Find the U Code text and remove everything before it
        intPos = InStr(strHTML, "U Code")
        strHTML = Mid(strHTML, intPos)
        
        'Find the next td tag. This will hold the data you are after
        intPos = InStr(strHTML, "<td")
        strHTML = Mid(strHTML, intPos)
        
        'Find the closing td tag and remove everything after it
        intPos = InStr(strHTML, "</td>") + 4
        strHTML = Left(strHTML, intPos)
        
        'strip off everything after the value
        intPos = InStr(strHTML, "</") - 1
        strHTML = Left(strHTML, intPos)
        
        'remove everything before your value
        intPos = InStrRev(strHTML, ">") + 1
        strHTML = Mid(strHTML, intPos)
        
        'this should be the value you are looking for
        Text1.Text = strHTML
        
    End Sub
    EDIT: Finished the example
    Last edited by MarkT; Dec 19th, 2008 at 03:06 PM.

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