tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,924
- Office Version
- 365
- 2019
- Platform
- Windows
My workbook is called abc.xlsm
I run the following code and it's fine, ie it saves it as abc.xlsm
If I now save my workbook, close it, change its name in Windows Explorer to abc 1.2.xlsm, then open and run the above code, the file is no longer saved as an Excel file,
ie in Windows Explorer, I see a file called abc 1.2 (without the .xlsm extension), so it doesn't know it's an Excel file, meaning double clicking doesn't automatically open it.
I suspect the reason for this odd behaviour is that abc 1.2.xlsm contains a "." in the filename.
Why does VBA behave in this way and going forwards, is it NOT a good idea to save filenames with a "."?
Thanks
I run the following code and it's fine, ie it saves it as abc.xlsm
Code:
ThisWorkbook.SaveAs Filename:=Left(String:=ThisWorkbook.FullName, _
Length:=Len(ThisWorkbook.FullName) - 5)
If I now save my workbook, close it, change its name in Windows Explorer to abc 1.2.xlsm, then open and run the above code, the file is no longer saved as an Excel file,
ie in Windows Explorer, I see a file called abc 1.2 (without the .xlsm extension), so it doesn't know it's an Excel file, meaning double clicking doesn't automatically open it.
I suspect the reason for this odd behaviour is that abc 1.2.xlsm contains a "." in the filename.
Why does VBA behave in this way and going forwards, is it NOT a good idea to save filenames with a "."?
Thanks