Sephaerius
New Member
- Joined
- May 30, 2013
- Messages
- 45
I'm troubleshooting yet another 2016 issue in which I have Kill statements in VBA to delete files, which has historically worked perfectly on 2013, yet now fails in 2016, and for the life of me I cannot figure out why.
To troubleshoot I've created a new Excel file and am running this test code:
Or
I have access to a virtual machine running 2013, and both functions work as expected, but when I pass the test file back to my machine running 2016, I get error 13.
I've checked the Immediate window to verify that the path String is being passed, and it is. I've added it to the Watch window and stepped through it and verified that the String is a String. I've been Googling this for a day and a half and cannot find any info on why this wouldn't be working.
Nothing is being matched here that would throw a mismatch. The only parts to this are the Kill statement, and the String. Does anyone have any thoughts as to what is happening here?
To troubleshoot I've created a new Excel file and am running this test code:
Code:
Function Test()
Kill "C:\Users\username\Desktop\New Text Document.txt"
End Function
Or
Code:
Function Test()
Dim strFile As String
strFile = "C:\Users\username\Desktop\New Text Document.txt"
Kill strFile
End Function
I have access to a virtual machine running 2013, and both functions work as expected, but when I pass the test file back to my machine running 2016, I get error 13.
I've checked the Immediate window to verify that the path String is being passed, and it is. I've added it to the Watch window and stepped through it and verified that the String is a String. I've been Googling this for a day and a half and cannot find any info on why this wouldn't be working.
Nothing is being matched here that would throw a mismatch. The only parts to this are the Kill statement, and the String. Does anyone have any thoughts as to what is happening here?