ich hätte eine große bitte, ich bräuchte einen Code, mit den ich alle Namen von Tabellenblättern einer geschlossenen xls Datei auslesen kann.
Kann mir jemand sowas basteln.
Danke und lieben Gruß
F.
Sub Test()
Dim strFile As String
Dim myFile As Workbook
Dim i As Integer, iCalc As Integer
strFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If strFile Like "*.xls" Then
With Application
iCalc = .Calculation
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
'wo die Daten hin sollen, Tabellenname anpassen
With ThisWorkbook.Sheets("Tabelle1")
On Error GoTo ErrorFile:
Set myFile = Workbooks.Open(strFile, , True)
On Error GoTo 0
' 'Überschrift Dateiname, falls gewünscht aktivieren
' .Cells(1, 1) = myFile.Name
' .Cells(1, 1).Font.Bold = True
For i = 1 To myFile.Sheets.Count
'wo die Daten hin sollen, eventuell anpassen.
'hier ab Zeile 2
.Cells(i + 1, 1).Value = myFile.Sheets(i).Name
Next i
myFile.Close False
End With 'ThisWorkbook.Sheets("Tabelle1")
ErrorFile:
.Calculation = iCalc
.EnableEvents = True
.ScreenUpdating = True
End With 'Application
End If
If Err.Number <> 0 Then
MsgBox "Datei konnte nicht geöffnet werden!", vbCritical
End If
End Sub
Gruß Tino