Macros missing in digitally signed templates

N

null_port

I have a word (2002 sp3) template I'm creating with a macro in it. The
macro is digitally signed. The macro contains only the following code:

Private Sub Document_Open()
MsgBox "asfasfasfsf"
End Sub

If I save this as a .dot in my user templates, leave it unsigned, and
create an instance of the template, the macro RUNS FINE (macro security
medium of course)

If I just open the template (not an instance, but the template itself),
the signed macro runs fine.

But if I open a new derived document (document n) of the template, but
sign it, the macro does not run (macro security set to any), and if I
try to open it in the vba editor, it only says "Project is unviewable".
The project is NOT protected, btw.

Any suggestions on making digitally signed macros work in templates?

Thx in advance
Noah Gray
 
N

null_port

Fyi, solved this. Apparently it's a non issue. Document_Open doesn't
fire when opening a document derived from a template, only when opening
the template itself. It's Document_New that fires in this case.

No idea why it was firing for unisigned templates. Could be pebcak.
 
C

Cindy M -WordMVP-

Hi Guillermo,
I'm just finishing a an application based on Word (a kind of Form) which
interacts with SQL Server etc...
I did quite a lot of research and, apparently, isn't a good idea to put code
in a .dot.
I think because you need to transfer the code from .dot to the .doc.
Well, this depends on exactly what you want. It's a good idea to put code in a
.dot, as long as the code doesn't need to travel with the doc. Code in the .dot
is available to all .docs created from the .dot, but they do have to be able to
access the .dot (know where to find it). This generally isn't a problem in a
company environment, but it can be if you need to send things out-of-house.

In this case, you might want to take a serious look at VSTO, especially the
version that's currently in release beta.

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 :)
 
G

Guillermo Worlicek

Thanks Cindy,

I read your document on MSDN. It was really helpful.
I have the Beta of VSTO but have not installed yet. Thanks for the hint.

My document had to travel and be used outside the company environment. So
..doc was the best solution I guess. Also, I put ActiveX Combo's data into
Custom Properties.... I placed over 2000 items.. and works fine!!!! So not
need to deliver with a hooked .mdb. I couyld sound a little bit dirty but
solves the problem.

Best regards,

Guillermo
 

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