How do I prevent my Template from being over-written?

  • Thread starter Thread starter Dennis Kuhn
  • Start date Start date
D

Dennis Kuhn

I've created a template in Excel97, but I'm not able to install it on
each and every computer that will be using it.

Normally, I'd like to put the file in the computer's Templates
directory so the user does a File->New... and uses the template file
that way. However, I'm forced to put the file out on a network
instead, which means the users will be using File->Open... instead.
Which means they can start entering data, and then hit the Save button
and over-write my template with a file that's got data entered into
it.

In the past, I've tried setting the Read Only property of the file,
and also automated a "File->Save As..." action using the SendKeys to
make the file type "Spreadsheet" (instead of "Template") and the
filename is "Type Your Filename Here.xls".

Neither solution is very elegant, I know.


Therefore, I am on a quest for a more elegant solution. I'd like to
trick Excel into thinking that the file was opened with "File->New"
with VBA code, if that's possible. It seems to me that THAT would be
the easiest solution. Is there some internal property that I can
toggle to make that happen? Or something similar?

Dennis
 
Very easy..
Firstly you don't need to put the file on the network. You can create an addin for this procedure and install it on the computers selectively. Therfore giving you more control

This addin will therefore allow you to open the file without the "Enable macro" warning. But put a procedure in the "Workbook_BeforeSave" event with an error handler to protect your document.
 
Tom Ogilvy said:
Using the file attribute to make it read-only seems both standard and
elegant.

Yeah, to you and me it seems pretty darned good.

But I still have to deal with end users with bare-bones computer
skills. They open the template, enter the data, hit save (forgetting
that they have to name it something unique), get the error message and
come to me with their confused complaint that "the computer ain't
workin'."

If I can just fool Excel into thinking they used File->New to open the
template, it'll automatically go to "Save as a worksheet, not a
template, and add a number 1 to the end of the filename" mode.

I'm just trying to reduce the Excel-generated error messages wherever
possible. I posed this question a couple of years ago, and my two
solutions work... but I keep thinking that there's GOT to be a better
way by now.

Dennis
 
Back
Top