ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs Code (https://www.excelbanter.com/excel-programming/350317-saveas-code.html)

Ronbo

SaveAs Code
 
What is the correct code to save the current workbook (Book1.xls) as
(Book1A.xls)

Thanks for the help.

Executor

SaveAs Code
 
Hi Ronbo,

Try this:

' Get the filename with path
sName = ThisWorkbook.FullName
' Add an 'A' to the end of the filename
sName = Left(sName, Len(sName) - 4) & "A.xls"
'Save under new name
ThisWorkbook.SaveAs sName

Hoop This Helps,


Executor


Ronbo

SaveAs Code
 
Thanks. Exactly what I was looking for.

"Executor" wrote:

Hi Ronbo,

Try this:

' Get the filename with path
sName = ThisWorkbook.FullName
' Add an 'A' to the end of the filename
sName = Left(sName, Len(sName) - 4) & "A.xls"
'Save under new name
ThisWorkbook.SaveAs sName

Hoop This Helps,


Executor




All times are GMT +1. The time now is 10:27 AM.

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