PDA

View Full Version : How to disable the prompt "Do you want to save the changes..."



littlebug
11-08-2007, 10:11 AM
I disabled "Save" and "Save as" under the File menu. But if users make changes and close the file using either Close or the x icon, Word prompts "Do you want to save the changes you made?"

How could I disable that? I don't want users to save this file.

(PDF... yeah. But can I do it with Word?)

Thanks a lot.

TonyJollans
11-08-2007, 10:24 AM
The real way to do this is with an Application BeforeSave event but you can do it more easily in a Document_Close event or an AutoClose macro by ..

Sub AutoClose()
ActiveDocument.saved = True
End Sub

(edited because I accidentally submitted too soon)

TonyJollans
11-08-2007, 10:30 AM
Word 2007 (with a free download from Microsoft) can save as PDF, but not earlier versions.

There are various packages out there that will create PDFs - SnagIt will do it, I know - there's also PrimoPDF, not sure what else. Google for it, it isn't hard and some of them are free.

littlebug
11-08-2007, 10:33 AM
Thanks Tony. But I don't want users to save this document at all. Any clue?

littlebug
11-08-2007, 11:15 AM
I mean, I don't want them to CHANGE it if they could save it.

TonyJollans
11-08-2007, 12:28 PM
Basically, if you let them read it they can do anything else as well. You can apply security to stop them overwriting the original but you can't stop them saving copies, changed or not.

Nelviticus
11-09-2007, 02:11 AM
You could lock the document and protect it with a password, then they wouldn't be able to make changes in the first place.

TonyJollans
11-09-2007, 02:22 AM
That is, I'm afraid, totally ineffective. If they make changes and try to save the document, Word very helpfully pops up the save as dialog.

Nelviticus
11-09-2007, 02:27 AM
True, "if they make changes", which they can't if the document is locked.

We do a similar thing for invoices generated by our financial management system and it works fine. Of course someone could always download password-cracking software but we're not trying to combat that level of intervention, we just want to make it impossible for a typical non-criminal user to change the invoice.

Nelviticus
11-09-2007, 02:27 AM
-

Nelviticus
11-09-2007, 02:27 AM
-

Nelviticus
11-09-2007, 02:29 AM
Crikey, not sure what happened there - apologies for the multiple posts :blush

TonyJollans
11-09-2007, 02:39 AM
So they copy and paste to a new document.

Word just isn't secure in this way at all.

Nelviticus
11-09-2007, 02:48 AM
No, if it's locked for editing you can't highlight anything. If you protect the document for Forms, then in combination with 'ActiveDocument.Saved = True' and some interception of 'FileSave' and 'FileSaveAs' it's pretty well locked down.

Nelviticus
11-09-2007, 02:50 AM
... although I do concur that Word isn't secure and isn't designed to be. The above approach is fine for stopping your own users from modifying/saving but no use if you want to stop the general public from doing so.

TonyJollans
11-09-2007, 03:38 AM
OK - it's good enough as a disincentive. :)

I'm not going to say how publicly just for the sake of it but it is possible to copy and paste a protetcted-for-forms document through the UI.

littlebug
11-09-2007, 11:56 AM
Nelviticus, thanks for your messages. My macro is exactly for invoice purpose.

lucas
11-09-2007, 12:12 PM
And pdf is not much better.....I can change them for you if you like..

TonyJollans
11-09-2007, 12:27 PM
:)

fumei
11-09-2007, 02:52 PM
No Word document is secure. If you can see it, you can get it. Heck even if you can't see it.....

littlebug, what is it EXACTLY you want?

If you are talking about unsophisticated users, AND you do not want them to make any edits/changes at all - in other words it is read only - then there are things you can do.

1. Make it read only.
2. Protect it for forms with your password.

Can this be hacked? Sure. By the "average user"? No.

If that it what you what - NO edits or changes allowed - then that is your answer.

If that is not what you want, please state what it is you DO want.

From the original post, it sounds like you want the user to be able to make changes...but never save them.

That sounds silly to me. Why bother?

Nelviticus
11-12-2007, 02:07 AM
Our problem was that any user could - and did - modify the invoices after the system had generated them, so invoices were going out that didn't match what was on the system. Despite telling them not to make changes, all too often somebody thought theirs was a special case and would do it anyway.

We just wanted a system that made it very hard for an internal user to edit the documents. If they had to download a password-cracker, or even do the sneaky trick that Tony alluded to, it would be explicitly obvious to them that they were doing something expressly forbidden, which was all we were after really. Locking the document for editing and blocking FileSave and FileSaveAs achieved this.

OTWarrior
11-12-2007, 02:29 AM
Would putting "Cancel = True"
in the close document event work?

OTWarrior
11-12-2007, 02:43 AM
or even:

word.activedocument.Close savechanges:=False
word.application.Quit

TonyJollans
11-12-2007, 03:15 AM
One thing I learnt a long time ago is that user requirements and management requirements rarely coincide, and that users are the ones in control. Time and again I have seen attempts by systems administrators to restrict built-in user facilities but I've never seen successful ones.

With all due respect, it seems to me that if you present a user with an editable invoice and tell them to send it out, you are just asking for it to be edited first. There may be nothing wrong with that approach but, if you choose it, you should expect and allow for such edits. If you don't want the edits, don't present the document in an editor.

TonyJollans
11-12-2007, 03:16 AM
OTWarrior,

I think ... Edit, Print, Don't Save ... is exactly what Neviticus wants to avoid.

OTWarrior
11-12-2007, 03:20 AM
I thought it was to do with the save prompt appearing? and he didn't want the user to save the document?

Nelviticus
11-12-2007, 03:25 AM
Alas we're restricted to how our financial management system works, and I suspect the original poster may be too. Ours generates its invoices as RTF documents which presents a whole obstacle course of problems as far as lock-down is concerned. Us mere techies have to work with what we're given and polish it up as best we can.

TonyJollans
11-12-2007, 03:42 AM
Oh, I do fully understand the position you are in, trying to make the best of a bad job over which you have little control, and I know how frustrating it can be.

fumei
11-12-2007, 11:05 AM
I also understand how difficult it can be, and frustrating.

" Despite telling them not to make changes, all too often somebody thought theirs was a special case and would do it anyway."

Ah yes, those "special cases" people.