Better yet, don't add a reference to it. Instead, use late binding. This means you'll use plain-vanilla object variables instead of the RegExp library's data types:
Dim objRegEx As Object
Set objRegEx = CreateObject("VBScript.Regexp")
Thus, you don't need to worry about the library version installed on the particular computer. The speed difference is pretty neglible for one call to it, but if you're going to use it regularly, create a public function like this:
Public Function RegEx() As Object
Static objRegEx As Object
If objRegEx Is Nothing Then
Set objRegEx = CreateObject("VBScript.Regexp")
End If
Set RegEx = objRegEx
End Function
Then you don't have to do anything at all -- just use RegExp the same way you'd use a variable that pointed to its top-level object. This will automatically initialize the first time you use it and will then persist until you close the application.
If you're concerned about cleaning up before closing down, you can do this:
Public Function RegEx(Optional bolClose As Boolean = False) As Object
Static objRegEx As Object
If bolClose Then
Set objRegEx = Nothing
Exit Function
End If
If objRegEx Is Nothing Then
Set objRegEx = CreateObject("VBScript.Regexp")
End If
Set RegEx = objRegEx
End Function
And in your app's shutdown routine call it thus:
Call RegEx(True)
And bob's your uncle!