Forum Discussion
Error when saving macro workbook as non-macro VBA
- Sep 08, 2023
It might be that strFile is too long (the maximum length of a sheet name is 31), or that it contains characters that aren't allowed in a sheet name: \ , / , * , ? , : , [ , ].
When the code is paused, press Ctrl+G to activate the Immediate window, type
? strFile
and press Enter.
wsPaste.Name = strFile
Do I have it in the wrong order? I'm trying to set a default filename for the user who wants to save a copy (which seems to be working as intended in the Save As dialogue box).
It might be that strFile is too long (the maximum length of a sheet name is 31), or that it contains characters that aren't allowed in a sheet name: \ , / , * , ? , : , [ , ].
When the code is paused, press Ctrl+G to activate the Immediate window, type
? strFile
and press Enter.
- TheNeedsOfManySep 09, 2023Copper Contributor
HansVogelaar Worked! It's 31 including the .xlsx, I think. Thanks for your help, Hans!
- TheNeedsOfManySep 08, 2023Copper ContributorAh, this is almost certainly the case. I'm going to mess around with my filename string and test again. I'll be sure to reply with my findings!