我具有VBA功能,在excel中可以完美工作。 但是我想从另一个宏运行该函数并在后台运行此marco ...
功能区HTML:
Public Function StripHTML(ActiveCell As Range) As String
Dim RegEx As Object
Set RegEx = CreateObject("vbscript.regexp")
Dim sInput As String
Dim sOut As String
sInput = ActiveCell.Text
sInput = Replace(sInput, "\x0D\x0A", Chr(10))
sInput = Replace(sInput, "\x00", Chr(10))
and a lot more replaces....
With RegEx
.Global = True
.IgnoreCase = True
.MultiLine = True
End With
sOut = RegEx.Replace(sInput, "")
StripHTML = sOut
Set RegEx = Nothing
End Function
Marco,正在调用该函数:
Sub actual()
Call Module3.StripHTML(ActiveCell)
Range("C2").Select
ActiveCell.Formula = "=IFERROR(StripHTML(tablename[@[column *]]),"""")"
End Sub
现在,当我在excel中使用公式StripHTML时,打开工作簿时,该功能可以正常使用。但是当我使用宏时,该功能不起作用... 有任何想法吗?