'********************************************** '*** Strip HTML ***** '**********************************************
'Remove HTML function Private Function removeHTML(ByVal strMessageInput)
Dim lngMessagePosition 'Holds the message position Dim intHTMLTagLength 'Holds the length of the HTML tags Dim strHTMLMessage 'Holds the HTML message Dim strTempMessageInput 'Temp store for the message input
'Place the message input into a temp store strTempMessageInput = strMessageInput
'Loop through each character in the post message For lngMessagePosition = 1 to CLng(Len(strMessageInput))
'If this is the end of the message then save some process time and jump out the loop If Mid(strMessageInput, lngMessagePosition, 1) = "" Then Exit For 'If an HTML tag is found then jump to the end so we can strip it If Mid(strMessageInput, lngMessagePosition, 1) = "<" Then
'Get the length of the HTML tag intHTMLTagLength = (InStr(lngMessagePosition, strMessageInput, ">", 1) - lngMessagePosition) 'If the end of the HTML string is in error then set it to the number of characters being passed If intHTMLTagLength < 0 Then intHTMLTagLength = CLng(Len(strTempMessageInput))
'Place the HTML tag back into the temporary message store strHTMLMessage = Mid(strMessageInput, lngMessagePosition, intHTMLTagLength + 1)
'Strip the HTML from the temp message store strTempMessageInput = Replace(strTempMessageInput, strHTMLMessage, "", 1, -1, 0) End If Next 'Replace a few characters in the remaining text strTempMessageInput = Replace(strTempMessageInput, "'", "'", 1, -1, 1) strTempMessageInput = Replace(strTempMessageInput, """", """, 1, -1, 1) strTempMessageInput = Replace(strTempMessageInput, " ", "", 1, -1, 1)
'Return the function removeHTML = strTempMessageInput End Function |