Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Programmatically detecting presence of named macro in workbook

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
--
Steve S
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Programmatically detecting presence of named macro in workbook

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

--
Regards,
Tom Ogilvy


"SteveS" wrote:

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
--
Steve S

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Programmatically detecting presence of named macro in workbook

"Tom Ogilvy" wrote:

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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Programmatically detecting presence of named macro in workbook

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.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Programmatically detecting presence of named macro in workbook

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

"SteveS" wrote in message
...
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
--
Steve S





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Programmatically detecting presence of named macro in workbook

"NickHK" wrote:

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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not detecting Open Workbook - Why Roger Excel Discussion (Misc queries) 7 January 26th 08 08:16 PM
macro to delete all named ranges in a workbook en masse? Dave F Excel Discussion (Misc queries) 1 November 3rd 06 09:17 PM
Detecting if workbook running in IE or in Excel SkylineGTR Excel Programming 5 November 13th 05 01:20 AM
Detecting a another workbook has opended Nigel Excel Programming 1 May 7th 05 08:19 AM
Detecting workbook activation Jack Wolf Excel Programming 0 July 26th 03 01:10 AM


All times are GMT +1. The time now is 10:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"