Read in text from an ascii file?
To read a line of text at a time from a TXT file:
Sub ReadFromFile()
Dim FileNum As Integer
Dim FileName As String
Dim InputBuffer As String
FileName = "C:\Folder\File.TXT"
FileNum = FreeFile
' A little error checking
If Dir$(FileName) <> "" Then ' the file exists, it's safe to continue
Open FileName For Input As FileNum
While Not EOF(FileNum)
Input #FileNum, InputBuffer
' Do whatever you need to with the contents of InputBuffer
MsgBox InputBuffer
Wend
Close FileNum
Else
' the file isn't there. Don't try to open it.
End If
End Sub
See How do I use VBA code in PowerPoint? to learn how to use this example code.
Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.