函数如下:
Function RemoveHTML(strText)
Dim RegExs
Set RegExs = New RegExp
RegExs.Pattern = "<[^>]*>"
RegExs.Global = True
RemoveHTML = RegExs.Replace(strText, "")
End Function
使用方法:
直接RemoveHTML(内容)
这样就屏蔽了所有的html标签
本文介绍了一个简单的VBA函数,用于从文本中移除所有的HTML标签。通过使用正则表达式,此函数能够有效地清理包含HTML标签的字符串。
函数如下:
Function RemoveHTML(strText)
Dim RegExs
Set RegExs = New RegExp
RegExs.Pattern = "<[^>]*>"
RegExs.Global = True
RemoveHTML = RegExs.Replace(strText, "")
End Function
使用方法:
直接RemoveHTML(内容)
这样就屏蔽了所有的html标签

被折叠的 条评论
为什么被折叠?