' Excel macro to include text. ' IncludeText Function By Fred Houweling fred@houweling.com.au Public Function IncludeText(FileName As String, Seperator As String, RowNdx As Integer, ColNdx As Integer) As String Dim WholeLine As String Dim Pos As Integer Dim MyRow As Integer Dim MyCol As Integer Dim NextPos As Integer Dim TempVal As Variant On Error GoTo EndIncludeText Application.ScreenUpdating = False Open FileName For Input Access Read As #1 MyRow = 1 While Not EOF(1) Line Input #1, WholeLine If MyRow = RowNdx Then If Right(WholeLine, 1) <> Seperator Then WholeLine = WholeLine & Seperator End If MyCol = 1 Pos = 1 NextPos = InStr(Pos, WholeLine, Seperator) While NextPos >= 1 TempVal = Mid(WholeLine, Pos, NextPos - Pos) If MyCol = ColNdx Then ' Found it Application.ScreenUpdating = True Close #1 IncludeText = TempVal Return End If Pos = NextPos + 1 MyCol = MyCol + 1 NextPos = InStr(Pos, WholeLine, Seperator) Wend End If MyRow = MyRow + 1 Wend EndIncludeText: On Error GoTo 0 Application.ScreenUpdating = True Close #1 End Function