Determine if doc has attached code

T

tartancli

Hi,
I have a problem which i hope somebody can help me with. In my Word 2003 COM
Addin, I want to determine if any open documents have associated code. I do
this as follows,

int vbComps = doc.VBProject.VBComponents.Count;

However, if the user has not selected "Trust Access to Visual Basic Project"
macro security setting then any attempt to access VBProject object members
results in an Exception "Programmatic access to Visual Basic Project is not
trusted".

I understand that this security setting is intended to stop virus inserting
code into macros. However, I only want to know if there is code or not. Is
there any way to determine this with this secruty setting?

Thanks in advance
 
C

Cindy M.

The OP has received replies to this duplicate question in
word.vba.customization

Cindy Meister
 

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