ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   file extension (https://www.excelbanter.com/excel-programming/298276-file-extension.html)

Young-Hwan Choi

file extension
 
I just upgraded from Office 2000 to Office 2003.
This is the code that I made from 2k version.

Sub Make_File()
Workbooks(my_book).Sheets("form").Copy
Set New_File = Workbooks(Workbooks.Count)
New_File.SaveAs Filename:=my_Dir & Sheets(1).Range("A1")
New_File.Close
End Sub

"my_dir" is a string and defined as "D:\test"
A1 is also string and includes a period, say A12.34

While it works fine in V. 2K, V. 2003 is not working fine..
The files that are generated from V. 2003 don't have file extension. And I
realized that the reason was because there was a period in the cell A1. (if
there is no period, it gives me an xls extension). The file name is "A12.34"
instead of "A12.34.xls".

Is there any structural cure for this instead of manually adding & ".xls" ?

thanks.



Nigel[_8_]

file extension
 
Same thing exists in XL2002 and AFAIK you need to add the extension. XL
will parse the string and read the DP as the name.ext separator. I have not
found another way around it.

Cheers
Nigel


"Young-Hwan Choi" wrote in message
...
I just upgraded from Office 2000 to Office 2003.
This is the code that I made from 2k version.

Sub Make_File()
Workbooks(my_book).Sheets("form").Copy
Set New_File = Workbooks(Workbooks.Count)
New_File.SaveAs Filename:=my_Dir & Sheets(1).Range("A1")
New_File.Close
End Sub

"my_dir" is a string and defined as "D:\test"
A1 is also string and includes a period, say A12.34

While it works fine in V. 2K, V. 2003 is not working fine..
The files that are generated from V. 2003 don't have file extension. And I
realized that the reason was because there was a period in the cell A1.

(if
there is no period, it gives me an xls extension). The file name is

"A12.34"
instead of "A12.34.xls".

Is there any structural cure for this instead of manually adding & ".xls"

?

thanks.






All times are GMT +1. The time now is 09:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com