ich habe eine frage.Vielleicht könnt ihr mir helfen.
ich versuche eine Auswertung zu erstellen und diese soll in eine neue Instanz von Excel kopiert werden.
Aber irgendwie klappt das nicht :(
Ich habe unten einen code angefügt damit ich als erstes eine neue Instanz erstelle und dann ein Tabellenblatt aus einem bereits geöffnetem Workbook in die neue INstanz kopieren möchte.Es kommt aber in dieser zeile immer ein fehler:
"newwb.Worksheets("vorlage").Copy After:=objExcel.Workbooks(neu.Name).Worksheets(1)"
Das Problem liegt an "After:=objExcel.Workbooks(neu.Name).Worksheets(1)"
Aber das "neu" ist ja meine neue Instanz.Könnt ihr mir helfen ?
Vielen Dank im vorraus gruß Chris
Option Explicit
Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
Set neu = objExcel.Workbooks.Add
objExcel.Visible = True
objExcel.WindowState = xlMaximized
'Alle Tabellen löschen bis auf eine dann 3 neue erstellen
Application.DisplayAlerts = False
For Each w In neu.Worksheets
On Error GoTo geloescht
w.Delete
Next
geloescht:
Application.DisplayAlerts = True
neu.Worksheets.Add
neu.Worksheets.Add
'Daten kopieren und in neue Datenbank für Diagramm einfügen - noch ohne zusatzkriteruien nur nach datum !
Windows(newwb.Name).Visible = True
newwb.Worksheets("vorlage").Copy After:=objExcel.Workbooks(neu.Name).Worksheets(1)