Thema Datum  Von Nutzer Rating
Antwort
Rot do while Schleife oder For ?= Danke
14.08.2018 11:23:42 Nicolai
NotSolved
14.08.2018 11:34:39 Nicolai
NotSolved
14.08.2018 15:15:52 Gast77431
NotSolved
14.08.2018 15:30:24 Gast73672
NotSolved
14.08.2018 16:31:09 Nicolai
NotSolved
15.08.2018 12:29:14 Gast70541
NotSolved

Ansicht des Beitrags:
Von:
Nicolai
Datum:
14.08.2018 11:23:42
Views:
814
Rating: Antwort:
  Ja
Thema:
do while Schleife oder For ?= Danke

Hallo zusammen . 

Ich habe ein Tool geschrieben und zwar konvertig von csv in xlsx Dateiformat.Es ist funktioniert einwandfrei.  

Trotzt brauche ich euere Unterstütztung:  Fragen : 

Wie kann ich, statt direkten Pfad : z.b.    csvPath = "\\afspv1hom001.eu1.1corp.org\g126725$\Documents\Tool abc\"

1
xlsPath = "\\afspv1hom001.eu1.1corp.org\g126725$\Documents\Tool abc\"


Eine do while schliefe oder for schleife. Das die alle dateien, in dem diesem tool ist, bearbeiten werden, ohne hard codierten Pfad, sondern so z.b. :
 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Dim strPath As String
 Dim strFile As String
 Dim Pfad As String
  Dim DateiName As String
   
 
 strPath = ThisWorkbook.Path & "\"
  
   
 
 strFile = Dir(ThisWorkbook.Path & "\" & "*.csv")
  
 '''''''''''''''''''''''''''''''''''''''''''''''''''
 'Pfad = ThisWorkbook.Path & "\"
   
  ' DateiName = Dir(ThisWorkbook.Path & "\" & "*.csv")
    
 'parF1 = Dir(Pfad & "*.csv")
  '''''''''''''''''''''''''''''''''''''''''''''''''''
 Do While strFile <> ""
     
  Debug.Print strPath & strFile


___________________________

Volles programm. Eure meinungen, bitte schön :D


Danke im Voraus .

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
Public Sub csvToxlsx()
    Dim FSO As Object
    Dim folder As Object
    Dim wb As Object
    
     
    
     
    csvPath = "\\afspv1hom001.eu1.1corp.org\g126725$\Documents\Tool abc\"
    xlsPath = "\\afspv1hom001.eu1.1corp.org\g126725$\Documents\Tool abc\"
     
     'csvPath = "O:\Transform_Tool\"
    'xlsPath = " O:\Transform_Tool\"
     
     
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set CSVfolder = FSO.GetFolder(csvPath)
     
    If FSO.FolderExists(xlsPath) = False Then
        FSO.createFolder (xlsPath)
    End If
     
    Set XlsFolder = FSO.GetFolder(xlsPath)
     
    With Application
        .DisplayAlerts = False
        .ScreenUpdating = False
    End With
         
    For Each wb In CSVfolder.Files
        If LCase(Right(wb.Name, 3)) = "csv" Then
            Set activeWB = Workbooks.Open(wb)
            activeWB.SaveAs FileName:=xlsPath & "\" & Left(activeWB.Name, Len(activeWB.Name) - 3) & "xlsx", FileFormat:=xlOpenXMLWorkbook, Local:=True
            activeWB.Close True
        End If
    Next
     
    With Application
        .DisplayAlerts = True
        .ScreenUpdating = True
    End With
End Sub

 


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
Rot do while Schleife oder For ?= Danke
14.08.2018 11:23:42 Nicolai
NotSolved
14.08.2018 11:34:39 Nicolai
NotSolved
14.08.2018 15:15:52 Gast77431
NotSolved
14.08.2018 15:30:24 Gast73672
NotSolved
14.08.2018 16:31:09 Nicolai
NotSolved
15.08.2018 12:29:14 Gast70541
NotSolved