ich hoffe ihr könnt mir bei dem unten stehenden Code helfen.
ich versuche eine Datei zu öffnen, daraus einen Wert zu holen und diesen Wert in eine andere datei zu kopieren.
es kommt aber der Laufzeitfehler 438.
Bitte um Hilfe
Private Sub workbook_open()
Dim z As Date, w As Date
Dim y As Integer, x As Integer
Dim Montag As String, Mittwoch As String
Dim wbZiel As Workbook
Dim wbQuelle As Workbook
Dim strfile As String, wb As String
Application.WindowState = xlMaximized
ActiveWindow.WindowState = xlMaximized
strfile = ThisWorkbook.Path & "\" & "Betriebstagebuch_" & Year(Date) - 1 & ".xlsm"
Set ex = CreateObject("Excel.Application")
Set wbZiel = ThisWorkbook
Set wbQuelle = ex.Workbooks.Open(strfile, , , , "bl")
With wbQuelle
.Sheets("Eingabe").Activate
.Cells(8, 4).Select ' hier kommt der Laufzeitfehler 438
Selection.Copy
End With
With wbZiel
.Sheets("Eingabe").Activate
.Range(Cells(1, 1)).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End With
wbQuelle.Close