ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatically include contents of a cell in "Save As..." filename. (https://www.excelbanter.com/excel-programming/308557-automatically-include-contents-cell-save-filename.html)

Bryan Linton

Automatically include contents of a cell in "Save As..." filename.
 
I've created a template called "Field Rating - .xls". I chose that filename
so when users try to save new workbooks created from that template, they'll
get a default filename of "Field Rating - 1.xls". Then they can simply
replace the "1" with the customer's name and save.

My question is, is there a way to automatically incorporate the contents of
a cell in the filename on first save? That way, users could open the "Field
Rating - " template, enter the customer name in a particular cell and use
the workbook, then save it without having to modify the filename. When the
"Save As..." box pops up, the filename would automatically read, for
example, "Field Rating - Mary Lennox.xls".

Not sure how to go about this...google searches haven't been fruitful.

Btw, using Office 2000, although soon to migrate to 2003.

Thanks in advance,

Bryan



grinning_crow[_7_]

Automatically include contents of a cell in "Save As..." filename.
 
As far as I know there are two things you could do;

This would simply save the file automatically and not give them
chance to change the name, adding the contents of cell A1 to the end o
your specified string:

sub workbook_beforeclose(cancel as integer)

activeworkbook.saveas "Field Rating - " & sheet1.range("A1")

end sub


I'm using 2003 so not sure if this one is available in 2000, but migh
be worth a try. It will basically bring up the saveas dialog box an
suggest the concatenated result of your standard string and th
contents of cell A1:

sub workbook_beforeclose(cancel as integer)

activeworkbook.getsaveasfilename "Field Rating - "
sheet1.range("A1")

end sub


I'd recommend having a look at the help files for these methods to ge
a full idea of what can be done with them.

Hope this helps

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 07:19 AM.

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