How do I stop people from saving a workbook as a particular name?

S

Simmo

Hi,

can anyone help?

I want to stop users opening a particular workbook and then saving that
workbook as "master.xls".

So if they open the document called master.xls, if any save action is
invoked (i,e they click "save" or "save as") - they are prompted with a
message telling them to save as a different name (if they are about to
save it as master.xls).

If the autosave is on - is there anywhere I can use this to prompt them
to save as sat "dummy1.xls"? If not then, no matter. As long as they
cant save as "master.xls".

Does anybody know how to write the VBA code to do this? I know it needs
to go in the worksheet_Beforesave() event.

Many thanks,
 
P

Paul Berkowitz

can anyone help?

I want to stop users opening a particular workbook and then saving that
workbook as "master.xls".

So if they open the document called master.xls, if any save action is
invoked (i,e they click "save" or "save as") - they are prompted with a
message telling them to save as a different name (if they are about to
save it as master.xls).

If the autosave is on - is there anywhere I can use this to prompt them
to save as sat "dummy1.xls"? If not then, no matter. As long as they
cant save as "master.xls".

Does anybody know how to write the VBA code to do this? I know it needs
to go in the worksheet_Beforesave() event.

Why don't you just save the master as a Template (.xlt), not as a Workbook?
Put it into a subfolder of Microsoft Office 2004/Templates - either My
Templates or another subfolder you make there. (Or you can designate another
folder for templates, not in Excel, but in Word/Preferences/File
Locations/User Templates.) Then tell your users to "open" it only via
File/Project Gallery/ in Excel, and in the My Templates or other directory
there. When they do that, a new unsaved workbook based on the master will
open as "Workbook 2" and they will have to give it a name when saving. It
will not alter the original master in any way. You just have to make sure
that they don't open the master template instead of a new workbook made from
it. Unfortunately, on the Mac, double-clicking the master will open the
original.

So here's maybe the _best_ solution. Save the master as STATIONERY (in the
Save As dialog, or just check "Stationery" in a Get Info for the file). Now,
no matter how they open it - double-clicking, File menu, anything - it will
make a new unsaved Workbook 2, etc. They have to give it a name when saving.
(In fact, it's quite awkward to make changes to the original when you
actually want to: you have to save as the original name in the original's
location, Save, and choose to Replace when asked.) The new workbooks are
"divorced" from their original, unlike documents made form templates, but
that's in fact exactly what you want here.

--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
J

JE McGimpsey

Paul Berkowitz said:
The new workbooks are "divorced" from their original, unlike
documents made form templates, but that's in fact exactly what you
want here.

That would be the case anyway - XL workbooks never have any tie to any
template that they're created from.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top