Scripting.FileSystemObject is an activex control object, and the function returns whether or not the argument filespec exists.
it should be (i believe):
Function rfs(ByVal filespec As String) As String
Dim fso, Msg
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(filespec)) Then
Msg = "YES"
Else
Msg = "NO"
End If
rfs = Msg
End Function