ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Renaming File (https://www.excelbanter.com/excel-programming/365387-renaming-file.html)

Arjun Dutta[_2_]

Renaming File
 
Hi please help me out on this...
Everytime i save the file, the file name should be changed to test1.xls;
second time i open & save the file, the name changes to Test2.xls & so on....

Bob Phillips

Renaming File
 
Put a _ before the number, like Test_2, and then use

With ActiveWorkbook
iPos = InStr(.Name, "_")
iFile = Mid(.Name, iPos + 1, InStr(.Name, ".") - iPos - 1)
.SaveAs Left(.Name, iPos) & (iFile + 1) & ".xls"
End With


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Arjun Dutta" wrote in message
...
Hi please help me out on this...
Everytime i save the file, the file name should be changed to test1.xls;
second time i open & save the file, the name changes to Test2.xls & so

on....




All times are GMT +1. The time now is 03:30 AM.

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