ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macros in Excel - Save as and rename file (https://www.excelbanter.com/excel-programming/274286-re-macros-excel-save-rename-file.html)

Bob Phillips[_5_]

Macros in Excel - Save as and rename file
 
Gisle,

This code snippet shows how it can be done


ActiveWorkbook.SaveAs "Bob", FileFormat:=xlCSV
sFile = ActiveWorkbook.Name
sPath = ActiveWorkbook.Path
ActiveWorkbook.Close

Dim objFSO As Object

Set objFSO = CreateObject("Scripting.FileSystemObject").Getfile (sFile)
objFSO.Name = Left(sFile, Len(sFile) - 3) & "ps"
Set objFSO = Nothing


Obviously, as it closes the file it must be in another workbook.


--

HTH

Bob Phillips

"Gisle Rong" wrote in message
...
Hello
I am to make a postscript (.ps) file from excel, but I cennot save the

excel
worksheet as a .ps file. I have therefore made a macro that saves the
worksheet as a .csv file. However, I have not managed to rename the .csv
file to a .ps file by usint the same macro.

The following is to be done:
Microsoft Excel formet - .csv format - .ps format.

Greatful for any reply.

Gisle Rong






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

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