2007 File New intercept Encrypt Password

J

Jules

Does anyone now if it is possible to add to my File New macro (and how) to
put in the password for Encrypted document templates so they stay encrypted
but allow the new document to be created?

I can post my File New intercept if that helps for my templates.

Many thanks
 
G

Gordon Bentley-Mix

Jules,

Send me your template and I'll have a look.
--
Cheers!
Gordon

Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
 
G

Gordon Bentley-Mix

And yes, I know you're working with 2007, but I have a new computer with 2007
on the way. If I can't sort it in 2003 I'll have a go when the new machine
arrives. ;-P
--
Cheers!
Gordon

Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
 
D

Doug Robbins - Word MVP

What features of the template do you want to protect?

If you are concerned about somebody changing your template,
see the article "Distributing macros to other users" at:

http://www.word.mvps.org/FAQs/MacrosVBA/DistributeMacros.htm

Fellow MVP Jonathon West who created that article provides the following
reasons for following that approach:


1. If you send a document to a customer, its attached network template is
unavailable (because it is on your network, not his). The customer may
suffer very long delays (2 minutes or more) before the document finally
appears on screen. This is because Windows can take a long time before
finally deciding that no reply is going to come from the network location
that Word requests. If the attached template is on a local drive, the
existence of the template can be checked very quickly, and so the document
opens immediately even if the template is not available. Microsoft is aware
of this problem, see http://support.microsoft.com/kb/830561. Microsoft does
have an operating system fix for the problem, but if you email documents to
people outside your organisation, you cannot assume that they will have the
fix installed.

2. If the network or server goes down, quite enough of the organisation's
operations are likely to grind to a halt without unnecessarily adding
word-processing to the list by making templates unavailable for use.

3. Storing templates & add-ins locally means that users with laptops don't
need a different setup. Their templates are stored locally in just the same
way as for permanently connected desktop machines, and they can receive
updates next time they connect to the network.

4. Templates and add-ins stored locally usually load faster, reducing
startup time and improving response times for Word.

5. Templates and add-ins stored locally don't load the network with
avoidable traffic, improving performance for other applications that must
use the network.

6. Editing and updating a template at a network location is much easier if
you don't have to break everyone's lock on the file in order to replace a
template with an updated version.

7. If a user manages to mess up a template (it happens sometimes) the only
person affected is himself, and the situation can be rectified quite easily
with a re-install.

8. If templates include VBA code, I have found that occasionally the code
behaves differently if the template is open concurrently on two different
PCs. I've never been able to identify the precise circumstance that will
trigger this, but when it has occurred, I have been able to reproduce it by
having the template open on one or two machines and seeing the actions of
the macro. This kind of problem is an absolute support nightmare, so I
always ensure that my templates are always stored locally.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jules

All true Doug but nothing I don't know do or use and have been a network
administrator for many years.

I'm talking about VBA to allow Encryption password on File New for a 2007
Word Macro Enabled Template as it stops to ask for the password before it
creates the new document. So I want to add VBA in my AutoExec to give
password so the new document can then be created.
As you know Doug with Protect Document Password that is useless but with
Encryption it solves that issue from what I can see.
I just don't know how to do it in VBA. I can Protect/Unprotect password 2003
but that is not encryption.

Maybe it can't be done - maybe there is no VBA to address the Encryption
password feature so it can continue on its merry way and create the new doc
from the macro enabled template.

Hope that is not to badly worded.

Thanks Doug
 
T

Tony Jollans

I'm not entirely sure what you mean by 'stay encrypted', but ..

I don't believe there's any way to automatically supply a template password
when creating a new document but you can get round it by opening the
template first, then creating the new document, and then closing the
template, something like this ..

Set Temp = Documents.Open(FileName:="YourTemplate", _
PasswordDocument:="ItsPassword",
_
Visible:=False)
Documents.Add Template:="YourTemplate"
Temp.Close
 
J

Jules

Sorry Tony

I intercept FileNew with my own macro. My macro lists templates I wish to
use your document add - I selet from a list and then the new document is
created from the existing template. I wanted to use the Prepare Encrypt
Password 2007 Word feature but after I select a template the Encrypt
Password is asked for and it also disables the macros in the template even
if you give the password onscreen.

I was looking for VBA equivalent like in ToggleFormLock for Protect
Formfields sort of Toggle.

Thanks anway.
 
T

Tony Jollans

Very interesting.

This is a change from 2003. My first guess would have been that it was
because the macros are encrypted in 2007 - except that it seems they are
visible (unencrypted) in the VBE, just disabled, and I cannot immediately
see how to enable them. The more I look and the more I change settings, the
more frustrated I become with this - even with 'allow all macros to run' and
the template in a trusted location, they are still disabled.

I am not a lover of the sometimes bizarre 'security' settings that Microsoft
seem determined to impose. It is easy to be secure - any idiot can make
things secure - what is difficult is finding the balance between security
and ability to use the product. It seems to me that, with 2007, the line has
been drawn in the wrong place.

I will dig a little and post back if I find anything useful.
 
J

Jules

Thanks Tony.
Tony Jollans said:
Very interesting.

This is a change from 2003. My first guess would have been that it was
because the macros are encrypted in 2007 - except that it seems they are
visible (unencrypted) in the VBE, just disabled, and I cannot immediately
see how to enable them. The more I look and the more I change settings,
the more frustrated I become with this - even with 'allow all macros to
run' and the template in a trusted location, they are still disabled.

I am not a lover of the sometimes bizarre 'security' settings that
Microsoft seem determined to impose. It is easy to be secure - any idiot
can make things secure - what is difficult is finding the balance between
security and ability to use the product. It seems to me that, with 2007,
the line has been drawn in the wrong place.

I will dig a little and post back if I find anything useful.
 
J

Jules

Just thought I'd mention I am allowing all macros to run and trust access to
the VBA project object model as my default. Plus my templates are in trusted
locations as are documents.
 
T

Tony Jollans

Hi Jules,

There is certainly something very odd going on here.

Fellow MVP Jay Freedman has discovered that it appears to work 'properly' if
the template is in a particular trusted location - the User Templates
folder. It may work in other places but it doesn't work in just any trusted
location, it seems to need some kind of a 'more than trusted' location.
 
J

Jules

Hi Tony,

My templates are on a wireless network with attached hard drive where this
template is being called from. The template has an Autoexec calling Content
Control variables in another document on the hard disk attached to the
wireless network.

I know in corporate because of network speed issues one downloads all
templates at login to users c: but that is not necessarily a must do.

Thanks for the report.
 
T

Tony Jollans

What about the Workgroup Templates folder? I have just tried and it does
work - although I haven't time to try it on a network location at the
moment.

Do you - or your users - already have a Workgroup Templates folder set up?
Even if you do have you may be able to hijack it - set it to your network
location, do your stuff, and set it back. It's rather a kludge and may not
be practical for what you are doing - it's just a thought. I'll try some
experiments - but it may not be until Tuesday now.
 
J

Jules

Tony
It is a FileNew macro select template from list (workgroup (server location)
or templates (user location) all trusted.
FileNew xxxx.dotm
Encrypt Password: xxxx
The macros then disable and the template content controls end up displayed
on the screen before the autotexec macro in template runs to fill in the
data.
I am not sure of VBA to use in autoexec macro that will allow me to provide
an encrypt password and not disable my template macro.

Tony/Jay I can link you to a folder offlist if you wish.
 
T

Tony Jollans

Hi Jules,

I'm not entirely following what you are doing (or trying to do). Are you
saying that the encrypted templates are in your user templates or workgroup
templates folders already? Where is your FileNew macro.

It might be easier to contact me off-list if you can let me see some code -
I trust you can interpret my e-mail address.
 
J

Jules

FileNew runs from a global template in User Startup
Templates come from WorkGroup (server disk)
Template itself has an Autoexec macro.
 
J

Jules

Thank you Tony for solving my problem.

Tony Jollans said:
Hi Jules,

I'm not entirely following what you are doing (or trying to do). Are you
saying that the encrypted templates are in your user templates or
workgroup templates folders already? Where is your FileNew macro.

It might be easier to contact me off-list if you can let me see some
code - I trust you can interpret my e-mail address.
 
T

Tony Jollans

For others reading this, the thread has wandered a little and there is an
issue that, coimcidentally, isn't relevant here.

The solution was actually, as per my first suggestion, to open the template
before basing a document on it. A password can be supplied on Documents.Open
(for either or both of the document and its template) but not (for the
template) on Documents.Add. This seems like an oversight and there don't
appear to be any problems with the workaround.

The issue that has shown up is that macros in encrypted documents and
templates can only be enabled when they are in particular locations. I am
reporting this to Microsoft.
 

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