Automatically include contents of a cell in "Save As..." filename.

  • Thread starter Thread starter Bryan Linton
  • Start date Start date
B

Bryan Linton

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
 
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
 
Back
Top