Function RemoveHTML(strText)
Dim nPos1
Dim nPos2
nPos1 = InStr(strText, "<")
Do While nPos1 > 0
nPos2 = InStr(nPos1 + 1, strText, ">")
If nPos2 > 0 Then
strText = Left(strText, nPos1 - 1) & Mid(strText, nPos2 + 1)
Else
Exit Do
End If
nPos1 = InStr(strText, "<")
Loop
RemoveHTML = strText
End Function
-------------------------------------
Function RemoveHTML( strText )
Set regex = CreateObject("VBScript.RegExp")
RegEx.Pattern = "<[^>]*>"
RegEx.Global = True
RemoveHTML = RegEx.Replace(strText, "")
End Function
------------------------------
以下去除以<p开头的html
Function RemoveHTML(strText)
Dim nPos1
Dim nPos2
nPos1 = InStr(strText, "<p")
Do While nPos1 > 0
nPos2 = InStr(nPos1 + 1, strText, ">")
If nPos2 > 0 Then
strText = Left(strText, nPos1 - 1) & Mid(strText, nPos2 + 1)
Else
Exit Do
End If
nPos1 = InStr(strText, "<p")
Loop
strText = Replace(strText, "</p>", "<br>")
RemoveHTML = strText
End Function
Sub a()
Dim i As Long, j As Long
For i = 3 To 50
Application.Workbooks(1).Sheets(1).Cells(i, 2) = RemoveHTML(Application.Workbooks(1).Sheets(1).Cells(i, 2))
Next i
End Sub