Below is a function from Tim Hastings (http://www.nonhostile.com/). This is a post from his blog. At the bottom of his code you can see he demonstrates his function with some html fed into the function.

I would like to know how you could use a function similar to this but instead of some html passed into the function...be able to pass the function a file or a group of files. How would you pass this function a file name or group of file names?

I'm thinking something like this...
Code:
Dim HTMLFile As String
HTMLFile = Dir("C:\TEMP\" & "*.html")
HTMLClean (HTMLFile)
Of course, this doesn't work. I think it has to do with the byVal reference in the function but I'm not sure and don't know what it should be. Any help is greatly appreciated. Thanks.
Code:
Private Function HTMLClean(ByVal strText As String) As String

    Dim objRegEx As VBScript_RegExp_55.RegExp
    
    ' replace <br>'s for a newline
    strText = Replace$(strText, "<br>", Chr$(10), 1, -1, vbTextCompare)
    
    ' replace non-breaking spaces for a space
    strText = Replace$(strText, "&nbsp;", Chr$(32), 1, -1, vbTextCompare)
    
    ' create new regex object
    Set objRegEx = New VBScript_RegExp_55.RegExp
    objRegEx.Global = True ' don't just operate on first find.
    
    ' remove HTML tags
    objRegEx.Pattern = "<[^>]*>"
    strText = objRegEx.Replace(strText, "")
    
    ' ditch excessive white space
    objRegEx.Pattern = "\s+"
    strText = objRegEx.Replace(strText, " ")

 

    ' thanks, bye
    Set objRegEx = Nothing

 

    ' named-entities
    strText = Replace$(strText, "&gt;", ">", 1, -1, vbTextCompare)
    strText = Replace$(strText, "&lt;", "<", 1, -1, vbTextCompare)

 

    ' insert your favourite named-entities here.
    strText = Replace$(strText, "&amp;", "&", 1, -1, vbTextCompare)  ' must do last
    
    ' return
    HTMLClean = strText
    
End Function


Debug.Print HTMLClean("<greets>Hello &lt;oh&gt;&nbsp;&amp;" & vbNewLine & _

                      "<b>I</b> <a href=""#"">wonder</a>  " & vbNewLine & _

                      "   what<br>will become of all this?</greets>")


Hello <oh> &I wonder what will become of all this?