Thema Datum  Von Nutzer Rating
Antwort
16.12.2017 15:37:56 Robert
NotSolved
Blau Excel Zeilen als einzelne Text-Dateien speichern
17.12.2017 11:16:41 Robert
NotSolved
17.12.2017 11:31:20 Gast64993
NotSolved

Ansicht des Beitrags:
Von:
Robert
Datum:
17.12.2017 11:16:41
Views:
711
Rating: Antwort:
  Ja
Thema:
Excel Zeilen als einzelne Text-Dateien speichern
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Hier das Skript:
---------------------------------
 
Option Explicit
 
Sub ErstelleDateien()
Dim strPath As String, strText As String, strDivider As String, strFileName As String
Dim lngRow As Long, lngStartRow As Long, lngLastRow As Long
Dim lngCol As Long, lngStartCol As Long, lngLastCol As Long
Dim FF As Integer
 
 
strPath = "C:\Users\Rober\Desktop\Skriptcode" 'Zielpfad
 
If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
 
strDivider = ";" 'Trennzeichen der Textdatei - Anpassen
 
lngStartRow = 4 'Erste Zeile mit Daten
 
lngStartCol = 3 'Erste Spalte (Dateiname)
 
With Sheets("Speichern der Datei1") 'Tabellenname - Anpassen
  lngLastRow = Application.Max(lngStartRow, .Cells(.Rows.Count, 4).End(xlUp).Row) 'letzte Zeile
  lngLastCol = Application.Max(lngStartCol, .Cells(lngStartRow, .Columns.Count).End(xlToLeft).Column) 'letzte Spalte
  For lngRow = lngStartRow To lngLastRow
    strFileName = strPath & .Cells(lngRow, lngStartCol) & ".txt"
    strText = ""
    For lngCol = lngStartCol + 1 To lngLastCol
      strText = strText & .Cells(lngRow, lngCol) & strDivider
    Next
    strText = Left(strText, Len(strText) - Len(strDivider))
    FF = FreeFile
    Open strFileName For Output As #FF
    Print #FF, strText
    Close #FF
  Next
End With
 
End Sub
 
--------------------------------------------------------------
 
Hier die Anleitung um das Skript mit einem Button zu starten.
 
<a href="http://praxistipps.chip.de/excel-button-einfuegen-so-gehts_39097" style="background-color: transparent; box-sizing: border-box; color: rgb(51, 153, 243); font-family: &quot;Open Sans&quot;,&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">http://praxistipps.chip.de/excel-button-einfuegen-so-gehts_39097</a><span style="display: inline !important; float: none; background-color: transparent; color: rgb(102, 102, 102); font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> </span>
 
--------------------------------------------------------------
 
Falls das Trennzeichen "," in der .txt Datei durch ein Zeilenubruch ersetzt werden soll,
dann den Befehl
 
<span style="display: inline !important; float: none; background-color: transparent; color: rgb(34, 34, 34); font-family: Arial,Verdana,sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;">strDivider = ";"
</span>
ersetzten in
 
<span style="display: inline !important; float: none; background-color: rgb(248, 248, 255); color: rgb(0, 0, 0); font-family: courier new; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;">strDivider = vbCrLf</span>
 
Alles kann auch hier:
nocheinmal nachgelesen werden.
 
Danke nochmal an Sepp, der mir dabei sehr weitergeholfen hat.
 
Viele Grüße
Robert

 


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
16.12.2017 15:37:56 Robert
NotSolved
Blau Excel Zeilen als einzelne Text-Dateien speichern
17.12.2017 11:16:41 Robert
NotSolved
17.12.2017 11:31:20 Gast64993
NotSolved