For some unknown (to me!) reason, I can't get this to work. The debugger definitely doesn't like my code, but I don't know why. Anyone have any ideas?
I get a Run-time error '424', Object required when the code executes.
Any advice on how to correct this would be most appreciated.
VBA Code:
Sub ReportDaily()
'Set up Variables
Dim FName As String
Dim FPath As String
Dim NewBook As Workbook
FPath = "X:\Sales\2020 Daily Sales Report\E-Mailed Reports"
FName = "2020 Daily Sales through " & Format(Now(), "MM-DD") & ".xlsx"
'Do some things
'Save the file
If Dir(FPath & "\" & FName) <> "" Then
MsgBox "File " & FPath & "\" & FName & " already exists."
Else
MsgBox "File to be saved as " & FPath & "\" & FName
Workbook.SaveAs FileName:=FPath & "\" & FName
End If
End Sub
I get a Run-time error '424', Object required when the code executes.
Any advice on how to correct this would be most appreciated.