ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to change saved name (https://www.excelbanter.com/excel-programming/314181-macro-change-saved-name.html)

roger

Macro to change saved name
 
I have a couple thousand rows of data that I need to sort
by supervisor. However, it is payroll info, so I have to
sort, copy, and paste each supervisors info into a new
workbook without showing them the other info, each book
will then be e-mailed to the respective supervisors.

I can writew a macro to do everything except change the
save name. I tried copying and pasting into the save as
box, but it continues to save it under the original name I
used when writing the macro. Is there anything I can do?

Thanks

Tom Ogilvy

Macro to change saved name
 
superName should hold the name of the supervisor.

sName = "C:\Folder1\" & superName & ".xls"
activeworkbook.SaveAs Filename:=sName
activeworkbook.Close SaveChanges:=False

--
Regards,
Tom Ogilvy


"roger" wrote in message
...
I have a couple thousand rows of data that I need to sort
by supervisor. However, it is payroll info, so I have to
sort, copy, and paste each supervisors info into a new
workbook without showing them the other info, each book
will then be e-mailed to the respective supervisors.

I can writew a macro to do everything except change the
save name. I tried copying and pasting into the save as
box, but it continues to save it under the original name I
used when writing the macro. Is there anything I can do?

Thanks





All times are GMT +1. The time now is 10:24 PM.

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