Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Protecting Word docs and killing WinWord in Task Manager

Status
Not open for further replies.

Anna007

Programmer
Nov 29, 2004
38
CA
I'm populating some word docs via Excel (tables and etc) but need to also protect it so no one changes this word doc afterwards. How do I do this? Can I password protect it?? I'm making them read-only but someone can copy and then change the copied version. I guess this is just normal anyways, no?

Also, when an error occurs, I have to go and kill WinWord in the task Manager manually. How do I do this via my VBA code?
I'm desparately in need of help asap.. thanx soooo much! :)

Anna
 
1. You could protect the document for forms (even though there may not be anyy forms in it). Protecting for forms permits the document to be opened, but does NOT allow any editing.

Tools > Protect Document > Forms. Use a password. Password protecting the document (Tools > Options > password protect) is an OPENING lock. Forms protection is an EDITING lock.

Also, when an error occurs, I have to go and kill WinWord in the task Manager manually. How do I do this via my VBA code? [/code]

Sorry, but that is quite vague, and makes it difficult to offer any ideas.

What kind of errors? Run-time errors? Varaioable errors? Overrun erros? if you are killing it with task manager it sounds like you are writing something that is causing an endless loop. Perhaps if you:

a) describe the errors, and any messages.
b) post some code that you think may be causing this

we may be able to help. As it is..."errors" is pretty darn general. there are plenty of things that cause errors.

Gerry
 
Well, I've made it read-only and therefore, no one is allowed to edit it. But they can do SaveAs and then, edit this file with the new name. I guess there is no other way to lock this so that they wouldn't change this in any way.. so, not even being able to do a SaveAs.

Now, as for errors, the program can run into any kind of a problem like: if the file is already open and it can't access it or if the file is corrupted or if the file wasn't found in the directory or... so, under any of these circumstances, an error is generated and therefore, winword doesn't get killed. So, I have to do it manually from the Task Manager.

Hope this helps more. :)
Anna
 
You can override the FileSaveAs command in Word.

As for the other errors, these should be trapped in the VBE, not trying to run it at run-time. They are dvelopemental issues, and again, should be trapped in the VBE first.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top