HTML toText
This little piece of code will strip all HTML tags from a web page. What your left with is pure text.
I've seen a few approaches, one which took up 500 lines of code. And some guy is selling an HTML stripper for $250. Rediculous.
This is my first post here. I just wanted to share and save someone some time.
Original Author: Sergio P
Assumptions
Just paste it into your form or module and call it. Text1 = HTML2Text(HTMLString1)
Code
Public Function HTML2Text(ByVal HTML As String) As String
Dim X As Long
Dim B As String
Dim String1 As String
Dim Counter As Long
X = 1
B$ = Mid(HTML, X, 1)
While Len(B$) = 1
B$ = Mid(HTML, X, 1)
If B$ = "<" Then Counter = Counter + 1
If Counter = 0 Then String1$ = String1$ + B$
If B$ = ">" And Counter <> 0 Then Counter = Counter - 1
X = X + 1
Wend
HTML2Text = String1
End Function
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.