AW: Beispiel modifizieren
30.06.2011 21:55:41
ransi
Hallo
Mit Print # und diesem Zeugs steh ich auf Kriegsfuß. Darum kann ich dir auch mit dem Beispiel nicht weiterhelfen.
Versuch mal sowas:
' **********************************************************************
' Modul: Tabelle1 Typ: Element der Mappe(Sheet, Workbook, ...)
' **********************************************************************
Public Sub machs()
Dim suchBegriff As String
Dim arr As Variant
Dim FSO As Object
Dim txtDatei As Object
Dim out As Variant
suchBegriff = "ABCD"
Set FSO = CreateObject("Scripting.FilesystemObject")
Set txtDatei = FSO.opentextfile("C:/testfile.txt")
arr = Split(txtDatei.readall, vbCrLf) 'in Zeilen aufteilen
txtDatei.Close
out = Filter(arr, suchBegriff, True)
If UBound(out) > -1 Then 'Es gibt Treffer
schreiben (Join(out, vbCrLf))
With Sheets("Tabelle1")
.Paste .Range("A1")
End With
End If
End Sub
Public Sub schreiben(derText As String)
Dim IE As Object
Set IE = CreateObject("HTMLfile")
IE.ParentWindow.ClipboardData.SetData "text", derText & vbNullString
Set IE = Nothing
End Sub
ransi