Hi Chandan,
When you say a macro runs when you open the doc--and previously you said
This is the macro if enabled, shows today's
date(if it was a date macro) in the footer of the document.
do you mean that when you open the doc the date in the footer changes to
today's, and you want to figure out which of those documents will do that?
Because that's not a macro.
The keyboard shortcut for Insert Date, and the icon on the header/footer
toolbar insert an automatically updating date field, {DATE}, so if either of
those were used in creating the doc, you get date changes when the doc is
reopened.
To fix old docs, select the field, toggle field codes on the right-click
menu (or hit alt-F9), and change the DATE field to CREATEDATE.
You need to open up a few of these documents and check whether that is the
solution.
For more information, see here:
http://word.mvps.org/FAQs/TblsFldsFms/DateFields.htm
Even if that isn't exactly it, what you think is a macro might be a field
updating, so be sure to check, using Alt-F9 to see field codes. It's much
more likely that a field is updating than it is that this company stored a
macro in each of thousands of documents.
Regardless, whether that is or isn't the problem, I had a feeling you
weren't on a Mac....you've been asking on a MacWord group. That's why
people keep mentioning AppleScript and Spotlight. You need to go ask on a
VBA group. For Windows, you might have more access to some of the document
properties without opening, and their VBA is different.
If the field code is the problem, the date parsing thing is easier, because
you only need to look for the field code, which will be { DATE } or { TIME
}, though possibly with some modifiers, e.g. { TIME \@ "d-MMM-yy" }. But you
get a {Time} field when people used Insert | Date and Time set to
automatically update, so it's much more likely to be a {Date} field, which
can be created accidentally. Ask the VBA people how you would automate the
process I stated above, of changing {Date} to {CreateDate}, once you've
confirmed that's what you need.
If it really is a macro, a macro that runs on opening is only going to have
a couple possible names, one of which would be AutoOpen.
Ask them whether there is a way to tell if a document has an AutoOpen or
similar macro stored in it. Your last post is the only one that has made it
very clear what you need, so repeat some of that, and be sure to state
versions. You might be able to get at those documents with macros that
execute on opening, I don't know whether VBA has hooks to return information
on VBA itself, though I'd imagine pulling a list of macros in the doc should
be possible.
However, I would say that rather than ask theoretical questions on the group
(as you did here), you need to sit down with a few of the problem documents,
develop a manual way to fix the problem, and then ask how to automate that
manual way, being sure to explain the context for why you need to automate
it. That way you'll be sure to get *something* useful, and if anyone can
think of a shortcut around your manual method, they'll probably share.
http://groups.google.com/group/microsoft.public.word.vba.general
Hope that helps,
Daiya