Microsoft KB Archive/57200

From BetaArchive Wiki

Extension Not Changing in Excel SAVE.AS() Command PSS ID Number: Q57200 Article last modified on 02-26-1993 PSS database name: W_eXceL

2.x 3.00 | 2.20 2.21 3.00

WINDOWS | OS/2

Summary:

In Excel, you can use the SAVE.AS() function in a macro to change the format of an already existing file. If the filename (including the extension) is not specified in the name_text parameter, the extension of the file will not change. For example, if you have the text file TEST.TXT and using the SAVE.AS command save the file as a normal Excel file, the filename will remain TEST.TXT.

The following macro finds the filename of the active sheet and adds the extension as coded in the macro:

rename =SET.NAME(“size”,FIND(“.”,GET.DOCUMENT(1))) =SET.NAME(“active_name”,LEFT(GET.DOCUMENT(1),size)&“XLS”) =SAVE.AS(active_name, 1,"",FALSE) =RETURN()

To save the file in a format other than normal, change the “XLS” string in the second SET.NAME() command and the second parameter of the SAVE.AS() command.

Copyright Microsoft Corporation 1993.