Programmatically detecting presence of named macro in workbook

S

SteveS

I have a client with a number of workbooks, which were generated from a
template. The template has been through a number of revisions. For
simplicity's sake, v1 did not have a given macro XXXX in, v2 did, and v3 (and
subsequent versions) did not.

Is there a way to identify whether a given workbook contains the macro XXXX
(but without running the macro) programmatically, so that those workbooks can
be backed up, and manually modified?

The presence of the macro actually tells us that some other VBA code in the
document is incorrect and will need updating, nothing more sinister, and
while I am familiar with 'standard' VBA stuff and automation in general (I
also design and code in C++, including COM servers and clients), I know
little about the internal structure of workbooks (since I've never needed to,
that's what automation is for...), so I'd appreciate any pointers. I
estimate that in total there are around 4500 documents to check, and
unfortunately, most have been updated on a regular basis, so datestamps don't
help (although some can be eliminated by creation time).

Thanks in advance
 
S

SteveS

Tom Ogilvy said:
You can get a head start at Chip Pearson's site
http://www.cpearson.com/excel/vbe.htm

Thanks, Tom, that's just the thing. I've 'converted' the relevant bits to a
C++ app that queries the GIT to make sure office apps aren't running, tweaks
the registry while it loads up excel, does it's stuff, then restores the
security settings, and it seems to be working !

Steve S
 
P

Peter Huang [MSFT]

Hi Steve,

Thanks for your knowledage sharing and Tom's contribution in the community.

Anyway if you still have any concern about this issue, please feel free to
let me know and I am happy to be of assistance.

Thanks!

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
N

NickHK

Steve,
Just looking at a workbook in a text editor, I can see the name of a custom
function.
As long as the routine names are unique, a scan of the text would show up.

NickHK
 
S

SteveS

NickHK said:
Steve,
Just looking at a workbook in a text editor, I can see the name of a custom
function.
As long as the routine names are unique, a scan of the text would show up.

NickHK

Thanks. I'd looked at that but rejected it, as I need to be more accurate
than that really. As it turns out, the advice given by Tom enables me to
perform the whole job. I run a scan of the XLS files first, and back them up,
and then apply the edits, so I'm quite pleased with that; I just send my
client an EXE and it's all done as far as they are concerned.
I really need to spend less time with a C++ development system and more
examining the Office stuff!


Steve S
 

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