Kyle Johnson2 said:I’m honestly at a loss for words here.
The only thing I can suggest left is this:
Download THIS file and save it somewhere on your hard drive. Create a folder at C:\Temp, unzip the file there, open Book1.xls, update the data, and hit the Save button. You should find a copy of the file sitting in C:\temp.
If that doesn't do the trick, I'm out of ideas—let me know what you ended up doing.
Best,
I downloaded your file and spotted the discrepancy... I'm not entirely sure why it happened, but it might help someone else:
1. On my machine:
Private Sub Workbook_BeforeSave(ByVal _
SaveAsUI As Boolean, Cancel As Boolean)
With ThisWorkbook
.SaveCopyAs ("c:\Temp\Backup of " & .Name)
End With
End Sub
--------------------------------------------------
Sub moja()
End Sub
- essentially - when I tried to run or save the code you told me to paste, a dialog box popped up asking for a routine name. I think things got a bit tangled, so I just hit ALT+F11 directly from the document and pasted it straight into the macro window.
2. In the file you sent over, there isn't anything in there except for the specific snippet you wanted me to insert:
Private Sub Workbook_BeforeSave(ByVal _
SaveAsUI As Boolean, Cancel As Boolean)
With ThisWorkbook
.SaveCopyAs ("C:\Temp\Backup of " & .Name) 'path to the archive folder
End With
End Sub
At this point, I suspect I'm making some sort of fundamental error. I figured I'd ask here because I'm sure others will run into this same confusion without knowing where they went wrong, just like me. 😢
Edit - I should mention that your version works perfectly fine. 😁