![]() |
Hidden File Extensions generating errors
Hi
I have a piece of code in Excel 2003 which at one point does this... ActiveWorkbook.SaveCopyAs FileName:=XLSsaveStr SetAttr (XLSsaveStr), vbNormal Workbooks.Open (XLSsaveStr) Workbooks(XLSsaveStrName).Activate Where XLSsaveStrName could be "data.xls" and XLSsaveStr "C:/My data/ data.xls" however the last line generates an error if I change my folder settings from view file extensions to hide extensions. That is XLSsaveStrName must become simply "data". The code worked fine until I distributed to another persons computer who has hidden file extensions. Is there a simple solution to the problem before I start attempting to change XLSsaveStrName using on error and charcter functions? The internet seemed surprisingly devoid of solutions to this problem when it could cause drastic problems for people attempting to distribute their code. Cheers Nick |
Hidden File Extensions generating errors
This works for me in W2K + Excel XP (can't say about Excel 2003), whatever
the value of that setting: Const FILEPATHNAME As String = "C:\Test\Test.xls" ActiveWorkbook.SaveCopyAs FILEPATHNAME Workbooks.Open FILEPATHNAME You may have problems with that setting when using the Windows collection, but the Workbooks collection should not. NickHK "Nick_F" wrote in message ups.com... Hi I have a piece of code in Excel 2003 which at one point does this... ActiveWorkbook.SaveCopyAs FileName:=XLSsaveStr SetAttr (XLSsaveStr), vbNormal Workbooks.Open (XLSsaveStr) Workbooks(XLSsaveStrName).Activate Where XLSsaveStrName could be "data.xls" and XLSsaveStr "C:/My data/ data.xls" however the last line generates an error if I change my folder settings from view file extensions to hide extensions. That is XLSsaveStrName must become simply "data". The code worked fine until I distributed to another persons computer who has hidden file extensions. Is there a simple solution to the problem before I start attempting to change XLSsaveStrName using on error and charcter functions? The internet seemed surprisingly devoid of solutions to this problem when it could cause drastic problems for people attempting to distribute their code. Cheers Nick |
All times are GMT +1. The time now is 01:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com