KeithGargett
New Member
- Joined
- Sep 2, 2019
- Messages
- 6
Hello,
I have had this piece of code within a few macros for a while and it has been working fine.
The VBA project has not been modified at all.
As far as i know nothing has changed with our company excel install, version etc. but it has suddenly started causing errors. Anyone know why, or alternative code to do the same task?
I get a file not found error (which i don't understand because the file in question is open & active), and the debug takes me to "If Len(Dir(f.Name)) = 0 Then"
the purpose of this piece of code is to remove a "Statistics" workbook from another tool used by multiple users, the code opens, writes to and closes the workbook in question.
Thanks in advance.
I have had this piece of code within a few macros for a while and it has been working fine.
The VBA project has not been modified at all.
As far as i know nothing has changed with our company excel install, version etc. but it has suddenly started causing errors. Anyone know why, or alternative code to do the same task?
I get a file not found error (which i don't understand because the file in question is open & active), and the debug takes me to "If Len(Dir(f.Name)) = 0 Then"
the purpose of this piece of code is to remove a "Statistics" workbook from another tool used by multiple users, the code opens, writes to and closes the workbook in question.
Thanks in advance.
Code:
Const ReviewEntry As Boolean = False
Dim f As RecentFile
For Each f In Application.RecentFiles
If Len(Dir(f.Name)) = 0 Then
f.Delete
ElseIf ReviewEntry Then
Debug.Print f.Name
Stop
End If
Next
ActiveWorkbook.UpdateLinks = xlUpdateLinksAlways
ActiveWorkbook.Save
ActiveWorkbook.Close
Last edited by a moderator: