函数如下:
Function RemoveHTML(strText)
Dim RegExs
Set RegExs = New RegExp
RegExs.Pattern = "<[^>]*>"
RegExs.Global = True
RemoveHTML = RegExs.Replace(strText, "")
End Function
使用方法:
直接RemoveHTML(内容)
这样就屏蔽了所有的html标签
去除HTML标签的VBA函数
本文介绍了一个简单的VBA函数RemoveHTML,该函数能够帮助开发者从文本中移除所有HTML标签。通过设置正则表达式的Pattern属性为'<[^>]*>',函数可以匹配并删除文本中的HTML标签。
函数如下:
Function RemoveHTML(strText)
Dim RegExs
Set RegExs = New RegExp
RegExs.Pattern = "<[^>]*>"
RegExs.Global = True
RemoveHTML = RegExs.Replace(strText, "")
End Function
使用方法:
直接RemoveHTML(内容)
这样就屏蔽了所有的html标签
906

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