Function OpenTextFile(FileName As String) As String
If FileName = "" Then Exit Function
Dim f As Integer
Dim lR As String
Dim RetVal As String
f = FreeFile
On Error GoTo ErrHandler
Open FileName For Input As f
'Optimized version
RetVal = Input(LOF(f), #f)
' While Not EOF(f)
' Line Input #f, LR
' RetVal = RetVal & LR & vbNewLine
' Wend
Close f
OpenTextFile = RetVal
ErrHandler:
End Function