Anleitung von Nepumuk
Nepumuk
Nepumuk hat mir mal dieses script geschrieben, wollte es erneut anwenden leider funktioniert es nicht richtig
kann mir Nepumik oder sonst jemand behilflich sein?
mit Gruss
Jürg
Option Explicit
Option Base 1
Public Sub Verzeichnis()
Dim intIndex As Integer, strTabelle As String, intSpalte As Integer
Dim strPfad As String, strDatei As String, varAdresse As Variant
varAdresse = Array("E30", "H30", "D33")
strPfad = "D:\Eigene Dateien\Eigene Tabellen\" (anpassen)
strTabelle = "Tabelle1" (anpassen)
With Application.FileSearch
.LookIn = strPfad
.FileType = 4
.Execute
For intIndex = 1 To .FoundFiles.Count
strDatei = Mid(.FoundFiles(intIndex), Len(.FoundFiles(intIndex)) - InStr(1, StrReverse(.FoundFiles(intIndex)), "\") + 2, InStr(1, StrReverse(.FoundFiles(intIndex)), "\") - 5)
Cells(intIndex + 1, 2) = strDatei
For intSpalte = 1 To 3
Cells(intIndex + 1, intSpalte + 2) = hole_Werte(strPfad, strDatei, strTabelle, CStr(varAdresse(intSpalte)))
Next
Next
End With
End Sub
Private Function hole_Werte(strPfad As String, strDatei As String, strTabelle As String, strAdresse As String) As Variant
On Error Resume Next
hole_Werte = ExecuteExcel4Macro("'" & strPfad & "[" & strDatei & "]" & strTabelle & "'!" & Range(strAdresse).Range("A1").Address(, , xlR1C1))
End Function