WallIT
02-15-2013, 10:21 AM
Hi,
We have a number of templates in use at our office. Some are protected for filling in forms. We use the same password across all our protected templates.
We use a custom toolbar which has a few printing macros. These macros change the page setup properties (first page, other pages) and select specific printers and print the document.
Obviously these macros don't work for protected documents, so we have worked around this by created template-specific macros for printing. These macros unprotect the document, change the page setup properties, reprotect the document and print it.
We are soon to introduce lots more templates and managing all these unique template-specific macros will become a headache! A better solution would be to enable our custom toolbar macro to be to detect if a document was protected, test it for our standard password, and if there is a match unprotect it, change the necessary settings and reprotect it.
Obviously there may be other documents (from outside) which are protected with other passwords, which I don't want the macro to attempt to unprotect.
I have found
If ActiveDocument.ProtectionType = wdNoProtection Then
which tests for protected documents, but is it possible to then test for a specific password (without showing an error if incorrect)?
Thanks in advance.
We have a number of templates in use at our office. Some are protected for filling in forms. We use the same password across all our protected templates.
We use a custom toolbar which has a few printing macros. These macros change the page setup properties (first page, other pages) and select specific printers and print the document.
Obviously these macros don't work for protected documents, so we have worked around this by created template-specific macros for printing. These macros unprotect the document, change the page setup properties, reprotect the document and print it.
We are soon to introduce lots more templates and managing all these unique template-specific macros will become a headache! A better solution would be to enable our custom toolbar macro to be to detect if a document was protected, test it for our standard password, and if there is a match unprotect it, change the necessary settings and reprotect it.
Obviously there may be other documents (from outside) which are protected with other passwords, which I don't want the macro to attempt to unprotect.
I have found
If ActiveDocument.ProtectionType = wdNoProtection Then
which tests for protected documents, but is it possible to then test for a specific password (without showing an error if incorrect)?
Thanks in advance.