Gruppe
Extern
Problem
Die Datei aus Zelle B1 soll eingelesen und in einer MsgBox ausgegeben werden.
StandardModule: Modul1
Sub GetText()
Dim sTxt As String, sText As String, sPath As String
sPath = Range("B1").Value
If Dir(sPath) = "" Then
Beep
MsgBox "Datei wurde nicht gefunden!"
Exit Sub
End If
Close
Open sPath For Input As #1
Do Until EOF(1)
Line Input #1, sTxt
sText = sText & sTxt & vbLf
Loop
Close
sText = Left(sText, Len(sText) - 1)
MsgBox sText
End Sub