Advertisement
Guest User

ElementSolutionMakro

a guest
Oct 30th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. Sub ElementImport()
  2. strExt = "*.XLS" 'Dateiextension ggf. anpassen
  3. ZuÖffnendeDatei = Application.GetOpenFilename("Textdateien (" & strExt & "), " & strExt, _
  4. Title:="Verzeichnisauswahl, erste Datei auswählen")
  5. If ZuÖffnendeDatei = False Then Exit Sub
  6. 'Die ausgewählte Datei ist egal. es wird hier nur das Verzeichnis der Datei ausgewertet
  7. Application.ScreenUpdating = False ' kein Bildschirm-Update - kein Flackern
  8. strPath = CurDir & "\"
  9. If strPath = "" Then
  10. Exit Sub
  11. Else
  12. ChDir strPath
  13. strFile = Dir(strPath & strExt) 'hier wird die erste Datei gefunden
  14. Do While Len(strFile) > 0
  15. Workbooks.OpenText Filename:=strPath & strFile, DataType:=xlDelimited, _
  16. TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, _
  17. Tab:=True, Semicolon:=False, Comma:=True, _
  18. Space:=False, Other:=False, trailingMinusNumbers:=True
  19. Sheets(1).Move After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
  20.  
  21. strFile = Dir() ' nächste Datei
  22. Loop
  23. End If
  24. Application.ScreenUpdating = True ' den Bildschirm-Update wieder zulassen
  25. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement