Can anyone spot the mistake. It gets as far as opening the new copy of the workbook sheets and that's all. Also, it is naming the new copy "2024.xlsx" instead of "Text (Date -1 mm/dd/yyyy)"
![]()
Please Login or Register to view this content.
Can anyone spot the mistake. It gets as far as opening the new copy of the workbook sheets and that's all. Also, it is naming the new copy "2024.xlsx" instead of "Text (Date -1 mm/dd/yyyy)"
![]()
Please Login or Register to view this content.
You can't have slashes ( / ) in a file name. Try changing the format to "mm-dd-yyyy".
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
Thank you! That worked.
When the new copy opens up it is asking me if I want to save it even though the new copied file already in its correct folder. Is there a way to bypass this popup?
My macro on the master workbook continues running on the new copy workbook instead of the master workbook. It is not closing the ActiveWorkbook copy. Do you know how to remedy this?
You've added a password and you've said Read Only Recommended. So, you will be asked for the password and you will be asked if you want to make changes.
Can't see any reason why it would have any issues with the location.
This line of code, Worksheets(Array("Sheet 1", "Sheet 2")).Copy, creates a new workbook which becomes the Active Workbook.
This line of code, ActiveWorkbook.SaveAs Filename:="file location removed for safety" & "Text" & Format(Date - 1, "mm-dd-yyyy") & ".xlsx", _
FileFormat:=xlOpenXMLWorkbook, WriteResPassword:="0000", ReadOnlyRecommended:=True, saves the newly created and active woorkbook
This line of code, ActiveWorkbook.Close, closes the newly created and active woorkbook
This then should make the Master workbook active again, all things being equal. Nothing in the code closes the Master workbook.
If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
Also, you may not be aware that you can thank those who have helped you by clicking the small star icon (Next to Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks