ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto Add to WB saved Name (https://www.excelbanter.com/excel-programming/373168-auto-add-wb-saved-name.html)

BEEJAY

Auto Add to WB saved Name
 
Have been trying for some time to determine how to add to a currently saved
workbook name. This is to indicate that the workbook in question has been
processed by the VB Programming.
I have used the following successfully, but so far have not been able to get
the extra added on the end of the name: eg: File name XYZ.XLS becomes
XYZ_Done.xls. I understand that I have to use the dot as a reference point,
since the actual workbook name could be any length (number of characters)
Any suggestions would be appreciated.

Dim OldName As String
Dim OldPath As String
Dim NewName As String

OldPath = ActiveWorkbook.Path & "\"
OldName = ActiveWorkbook.Name

NewName = "DONE_" + OldName

ActiveWorkbook.SaveAs NewName


Ron de Bruin

Auto Add to WB saved Name
 
Try this

NewName = OldPath & Left(OldName, Len(OldName) - 4) & "_DONE.xls"


--
Regards Ron de Bruin
http://www.rondebruin.nl



"BEEJAY" wrote in message ...
Have been trying for some time to determine how to add to a currently saved
workbook name. This is to indicate that the workbook in question has been
processed by the VB Programming.
I have used the following successfully, but so far have not been able to get
the extra added on the end of the name: eg: File name XYZ.XLS becomes
XYZ_Done.xls. I understand that I have to use the dot as a reference point,
since the actual workbook name could be any length (number of characters)
Any suggestions would be appreciated.

Dim OldName As String
Dim OldPath As String
Dim NewName As String

OldPath = ActiveWorkbook.Path & "\"
OldName = ActiveWorkbook.Name

NewName = "DONE_" + OldName

ActiveWorkbook.SaveAs NewName




BEEJAY

Auto Add to WB saved Name
 
Works Great. Thanks so much


"Ron de Bruin" wrote:

Try this

NewName = OldPath & Left(OldName, Len(OldName) - 4) & "_DONE.xls"


--
Regards Ron de Bruin
http://www.rondebruin.nl



"BEEJAY" wrote in message ...
Have been trying for some time to determine how to add to a currently saved
workbook name. This is to indicate that the workbook in question has been
processed by the VB Programming.
I have used the following successfully, but so far have not been able to get
the extra added on the end of the name: eg: File name XYZ.XLS becomes
XYZ_Done.xls. I understand that I have to use the dot as a reference point,
since the actual workbook name could be any length (number of characters)
Any suggestions would be appreciated.

Dim OldName As String
Dim OldPath As String
Dim NewName As String

OldPath = ActiveWorkbook.Path & "\"
OldName = ActiveWorkbook.Name

NewName = "DONE_" + OldName

ActiveWorkbook.SaveAs NewName






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

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