Counting the total number of macros in an Office document

R

Rick Barnsley

Hi,

I'm trying to programmatically count the number of macros within an Office
document.

I haven't had much luck with finding a solution online.

I have tried accessing the VBAProjects through:

Application.VBE.VBProjects(1).VBComponents.Count

only to receive the error:

---------------------------
Microsoft Visual Basic
---------------------------
Run-time error '1004':

Programmatic access to Visual Basic Project is not trusted

---------------------------
OK Help
---------------------------

Is there another function I can call to return the number of available
macros for a given document?

Cheers,
Rick
 

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