06.04.2016, 11:40
(Dieser Beitrag wurde zuletzt bearbeitet: 06.04.2016, 11:43 von floridarolf.)
Hallo zusammen,
habe eine kleine Herausforderung
Ich möchte eine Datei, die täglich neu abgelegt wird (unterscheidet sich nur durch das Datum) automatisiert mit einem Makro öffnen.
Sub Bericht()
dATEINAME = ActiveWorkbook.Name
Dim varDatum
varDatum = Worksheets(1).Range("b2").Value
varDatum = DateValue(varDatum)
varDatum = Format(varDatum, "yyyy-mm-dd") & ".xlsx"
Application.ScreenUpdating = False
If Dir("\\Dateipfad\CS&E Daily Dashboard-OE-2016- v3- " & varDatum) <> "" Then
GoTo 1
Else
MsgBox "Die Reports liegen noch nicht ab."
End If
GoTo 2
1:
Workbooks.Open Filename:="\\Dateipfad\CS&E Daily Dashboard-OE-2016- v3- " & varDatum, ReadOnly:=True
dateiname1 = ActiveWorkbook.Name
Leider wird die Datei vom Makro nicht erkannt und läuft sofort zur MsgBox
Was mache ich falsch?
Vielen Dank im Voraus
habe eine kleine Herausforderung

Ich möchte eine Datei, die täglich neu abgelegt wird (unterscheidet sich nur durch das Datum) automatisiert mit einem Makro öffnen.
Sub Bericht()
dATEINAME = ActiveWorkbook.Name
Dim varDatum
varDatum = Worksheets(1).Range("b2").Value
varDatum = DateValue(varDatum)
varDatum = Format(varDatum, "yyyy-mm-dd") & ".xlsx"
Application.ScreenUpdating = False
If Dir("\\Dateipfad\CS&E Daily Dashboard-OE-2016- v3- " & varDatum) <> "" Then
GoTo 1
Else
MsgBox "Die Reports liegen noch nicht ab."
End If
GoTo 2
1:
Workbooks.Open Filename:="\\Dateipfad\CS&E Daily Dashboard-OE-2016- v3- " & varDatum, ReadOnly:=True
dateiname1 = ActiveWorkbook.Name
Leider wird die Datei vom Makro nicht erkannt und läuft sofort zur MsgBox

Was mache ich falsch?
Vielen Dank im Voraus