word protection task pane (again)

K

klav

I posted an entry on this a few months back but I still have not been
successful in getting this to work. I'm using Word 2003 and have a document
that is protected. If the user attempts to change it, I do not want to
display the default Word protection task pane -- I want my own message to be
displayed or nothing. I have used the following website
http://word.mvps.org/faqs/macrosvba/taskpanesreferencecontentbody.htm
as reference and have tried some of the suggestions for intercepting
taskpanes that are on that site but nothing has worked. Has anyone been
successful in doing this?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?a2xhdg==?=,
I posted an entry on this a few months back but I still have not been
successful in getting this to work. I'm using Word 2003 and have a document
that is protected. If the user attempts to change it, I do not want to
display the default Word protection task pane -- I want my own message to be
displayed or nothing. I have used the following website
http://word.mvps.org/faqs/macrosvba/taskpanesreferencecontentbody.htm
as reference and have tried some of the suggestions for intercepting
taskpanes that are on that site but nothing has worked. Has anyone been
successful in doing this?
Just a quick test, but it does seem to intercept displaying this Task Pane:

1. A macro named ToolsProtect takes care of both the menu command, as well as
selecting the task pane from the drop down list at the top of any task pane.

2. A macro named ViewTaskPane will intercept showing any taskpane.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
K

klav

Thanks for your reply Cindy.....I have tried redefining a macro named
ViewTaskPane to overwrite Word's version but it still does not work -- where
does this macro need to be redefined -- it is in a regular module or an
autoexec macro or an application driven event? Please reply.......
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?a2xhdg==?=,
.I have tried redefining a macro named
ViewTaskPane to overwrite Word's version but it still does not work -- where
does this macro need to be redefined -- it is in a regular module or an
autoexec macro or an application driven event? Please reply.......
I created a Sub ViewTaskpane in a standard module project, for testing
purposes, in my Normal.dot template, but I can't see why it wouldn't work in a
regular template or document (as long as you're in that context).

Note that sometimes such macros don't trigger immediately. You might try
running it directly (F5), first, to make sure Word "sees" it's been created.

This is what I tested (Word 2003):

Sub ViewTaskPane()
MsgBox "Hi"
End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
K

klav

Thanks Cindy. I was able to replace the default "ViewTaskpane" word command
with my custom macro, as you defined below.

However, after a document is protected, if you attempt to type in that
document, the protection task pane is automatically displayed and regardless
of which macros I redefine (viewtaskpane, ToolsProtectUnprotectDocument), I
have been unsuccessful in disabling the protection task pane from being
displayed when you press any key in a protected document. It's as if "on key
press event" is attached to the document (although I don't think I can set
this kind of event for a document, only a form).

So to recap, what I want to do is protect a document from being edited by
using Word's protection function. If a user tries to edit the document, I do
NOT want Word's protection task pane displayed -- I want to display my own
message instead or nothing at all.....

I look forward to hearing your reply Cindy.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?a2xhdg==?=,
However, after a document is protected, if you attempt to type in that
document, the protection task pane is automatically displayed and regardless
of which macros I redefine (viewtaskpane, ToolsProtectUnprotectDocument), I
have been unsuccessful in disabling the protection task pane from being
displayed when you press any key in a protected document. It's as if "on key
press event" is attached to the document (although I don't think I can set
this kind of event for a document, only a form).
I've never noticed anything of this sort. Could you
- tell me exactly which protection you've selected
- in which version of Word
- what's in such a protected document

so that I can try to duplicate? (Note: when I think of document protection, I
think "protect as a form". I know there are other kinds, but I have to
understand exactly what you're trying to do.)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
K

klav

Cindy, I was using the the protection for making the file read only (no
changes). Believe it or not, it didn't occur to me until yesterday to try
making the file protected as a form -- my file is not a form in that there
are no user entry fields and I guess that is why it didn't occur to me to use
this option. This worked -- I no longer get the protection task pane.
Thanks for your help.

Now I have another problem that I cannot seem to solve. From another
application, I am opening a document in word and splitting it into two
documents and displaying the documents in print preview -- these files are
not being saved anywhere.

The user can switch between the preview of the two documents. I have a
button to exit gracefully which closes all appropriate documents without
saving (which is what I want) but if the user clicks on the window close icon
(X), no matter what I try, the save changes dialog is displayed. I want all
documents to close without displaying the "save changes" dialog box. I
cannot seem to do this. I have tried an autoclose macro, an autoexit macro, a
document close macro, an application close event but I keep getting prompted
if I want to save the changes. I'm using the following code but I have also
tried cycling through all open windows and specifically close each one
without saving and this doesn't work either. Can you help?????

Application.Quit savechanges:=wdDoNotSaveChanges
 
K

Klaus Linke

I want all documents to close without displaying the "save changes" dialog box.

Hi Klav,

Have you already tried myDoc.Saved=True?

Greetings,
Klaus
 

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