[RESOLVED] Get All Images Link from HTML
i wrote this.......
but when i use debug.print img then it dont show anything in intermediate area
vb Code:
Public Sub imgTag(theData As String)
Dim I As Long, Z As Long, S As Long, IMG As String
On Error GoTo HeLL
S = 1
Dim DD As String
For I = 1 To UBound(Split(Text2.Text, "src="))
S = InStr(S, Text2.Text, "<img src=" & Chr(34))
Z = InStr(S, Text2.Text, Chr(34))
IMG = Mid(Text2.Text, S, (Z - Z))
debug.print IMG
S = S + 5
Next
HeLL:
Exit Sub
End Sub
Re: Get All Images Link from HTML
Quote:
Originally Posted by _RaJ_
:lol:
Put something into your error handler. For example:
Code:
Debug.Print Err.Number & ", " & Err.Description
... to see what's wrong.
Re: Get All Images Link from HTML
Re: Get All Images Link from HTML
Try changing
IMG = Mid(Text2.Text, S, (Z - Z))
to
IMG = Mid(Text2.Text, S, (Z - S))
Re: Get All Images Link from HTML
Quote:
Originally Posted by MarkT
Try changing
IMG = Mid(Text2.Text, S, (Z - Z))
to
IMG = Mid(Text2.Text, S, (Z - S))
what is the diffrence!!?
Re: Get All Images Link from HTML
The last parameter of the mid function is for the number of characters to grab. In the code you posted lets assume that
S = 52
Z = 77
(Z - Z) = 0
So you are telling the mid function to grab 0 characters.
(Z- S) 15
So you are telling the mid function to grab 15 characters.