You have actually asked for a couple of tasks, I broke them down in the example. Post back if you have questions:
Option Explicit
Public Sub Example()
Dim strFileText As String
Dim strFinalValue As String
strFileText = GetFileText("C:\Test\MyTextFile.txt")
strFinalValue = ExtractTextAfter(strFileText, "bar", vbTextCompare)
MsgBox strFinalValue
End Sub
Private Function GetFileText(ByVal filePath As String) As String
Dim lngFileNum As Long
Dim lngFileLen As Long
Dim strFileText As String
lngFileNum = FreeFile
Open filePath For Binary Access Read Shared As #lngFileNum
lngFileLen = FileLen(filePath)
strFileText = String$(lngFileLen, vbNullChar)
Get #lngFileNum, , strFileText
Close #lngFileNum
GetFileText = strFileText
End Function
Private Function ExtractTextAfter(ByVal stringValue As String, ByVal subStringValue As String, _
Optional ByVal compare As VbCompareMethod = VbCompareMethod.vbBinaryCompare) As String
Dim lngDPos As Long
Dim strRtnVal As String
lngDPos = InStrRev(stringValue, subStringValue, -1, compare)
If lngDPos Then
strRtnVal = Mid$(stringValue, lngDPos + Len(subStringValue))
End If
ExtractTextAfter = strRtnVal
End Function