Can't believe I'm back because of this - This is sooooooooooooo frustrating!!!
So I un-hard coded the above lines of code - added the necessary variables and boom! Error after error
Below is what I'm working with
Code:
Dim strDate1 As String
Dim StrFile1 As String
Dim strDate2 As String
Dim StrFile2 As String
Dim FSO As FileSystemObject
Set FSO = New FileSystemObject
StrDate1 = Format(Now(), "YYYY-MM-DD"
StrFile1 = "N:\Sales\Internal\Current\SalesReportCurrent_" & StrDate1 & "*" & ".xlsx"
StrDate2 = Format(Now(), "YYYYMMDD"
StrFile2 = "N:\Sales\Internal\Archive\SalesReportArchive_" & StrDate2 & ".xlsx"
Debug.Print StrFile1
Debug.Print StrFile2
FSO.MoveFile StrFile1, StrFile2
When I run the above code I receive the following: A 76 Path Not Found Error
The Debug on StrFile1 = N:\Sales\Internal\Current\SalesReportCurrent_2014-04-14*.xlsx (Seems to be treating the * as a literal string)
The Debug on StrFile2 is perfect
Here is an interesting result - When I run the below
Code:
Dim strDate1 As String
Dim StrFile1 As String
Dim strDate2 As String
Dim StrFile2 As String
Dim FSO As FileSystemObject
Set FSO = New FileSystemObject
StrDate1 = Format(Now(), "YYYY-MM-DD"
StrFile1 = Dir("N:\Sales\Internal\Current\SalesReportCurrent_" & StrDate1 & "*" & ".xlsx")
StrDate2 = Format(Now(), "YYYYMMDD"
StrFile2 = "N:\Sales\Internal\Archive\SalesReportArchive_" & StrDate2 & ".xlsx"
Debug.Print StrFile1
Debug.Print StrFile2
FSO.MoveFile StrFile1, StrFile2
The results returned are a 53 File not found error - and
the Debug on StrFile1 brings back: SalesReportCurrent_2020-04-14-06-33-43.xlsx - Which is the precise name of the file I'm targeting to move - but the path is ignored
Help??
Thank You!!