Microsoft KB Archive/57200

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 19:25, 12 August 2020 by X010 (talk | contribs) (X010 moved page Microsoft KB Archive/Q57200 to Microsoft KB Archive/57200 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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



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.