[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

macro query re open file with date

can any Expert throw any light on this for me.

Have been using this code for a while and it's been fine but today its trying to open a file in a folder 1899 ???

Dim dt As Date
Dim wbk As Workbook
If Format(Now, "dddd") = "Monday" Then
lastWorkingDate = DateAdd("D", -3, Now())
   Else
    dt = DateAdd("d", -1, Now)
End If
Set wbk = Workbooks.Open("N:\EVERYONE\Ops to PC folders\" & Format(dt, "yyyy") & "\" & Format(dt, "MM MMM") & "\" & "Div rec " & Format(dt, "dd.MM.yyyy") & ".xlsx")

any ideas
0
Jagwarman
Asked:
Jagwarman
1 Solution
 
mvidasCommented:
Hi Jagwarman,

Change "lastWorkingDate" to "dt". Seems you have an old variable name in there.

Matt
0
 
JagwarmanAuthor Commented:
thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now