Names and descriptions of macros

L

Larry

I've tried the question once before, but am trying again. Would it be
possible in Word 97 to print a list of all macros and their
descriptions? I have a couple of hundred macros and I'd like a readily
readable list apart from the Macros dialog box.

The most I've found so far is the ability to type one macro description
at a time, like this:

With WordBasic
Selection.TypeText .MacroDesc$("BoldBracketedText")
End With

But I want to create list of names and descriptions of all macros.

Any ideas?

Larry
 
S

smitty_one_each

Larry said:
I've tried the question once before, but am trying again. Would it be
possible in Word 97 to print a list of all macros and their
descriptions? I have a couple of hundred macros and I'd like a readily
readable list apart from the Macros dialog box.

The most I've found so far is the ability to type one macro description
at a time, like this:

With WordBasic
Selection.TypeText .MacroDesc$("BoldBracketedText")
End With

But I want to create list of names and descriptions of all macros.

Any ideas?

Larry

This is not a complete solution.
I actually have to do the reverse, but my research might benefit you
In Word2000, something along the lines of:

Word.VBE.ActiveCodePane.CodeModule.Lines

will let you tap the text in the modules. You'll want to copy them to
a string variable.
Then set a reference to Microsoft VBScript Regular Expressions 5.5.
Write a reg ex that will handle the public/private sub/function
aspects of the code.
Feed the reg ex one module at a time, in a for each...next loop.
Either write the results to a text file, or make a database with a
table and an append query.

Like I said, I'm doing the opposite. I have a database of document
id values in an online repository. For security reasons, I need to
use Word to instantiate IE and log in, then drive IE to specific
documents via links.
As there seems to be no way to pass arguments via the MACROBUTTON
field, I need to write a module with a metric bootyload of individual
Sub calls that will invoke the IE Navigate() method, once log-in is
effected.
Probably a BFH approach, but I can't think of anything easier that
meets the security requirements.
 
S

smitty_one_each

Larry said:
I've tried the question once before, but am trying again. Would it be
possible in Word 97 to print a list of all macros and their
descriptions? I have a couple of hundred macros and I'd like a readily
readable list apart from the Macros dialog box.

The most I've found so far is the ability to type one macro description
at a time, like this:

With WordBasic
Selection.TypeText .MacroDesc$("BoldBracketedText")
End With

But I want to create list of names and descriptions of all macros.

Any ideas?

Larry

Setting a reference to Microsoft Visual Basic For Applications
Extensibility 5.3
allows for some handy stuff:

dim basWord as Dim basWord As VBIDE.CodeModule
Set basWord = docWord.VBProject.VBE.VBProjects(1).VBComponents(1).CodeModule
'...run a query that builds little convience subs (VBA in SQL is
perverse)...
basWord.AddFromString rstWork.Fields(0)

Note that this is MS Access2000 driving Word2000. Something similar
probably went on in Word97. Again, a regular expression is what you
need to make this work. If you can't set a reference to a VBScript
RegEx library, consider dumping you modules to text and then using
Perl or Python (which you can download) to do the RegEx-ing.
If it's all new to you, Python has the less-foreign syntax of the two.
 
L

Larry

This is all Greek to me. But I'll save your messages and try to make
something out of them.

Thanks,
Larry
 
L

Larry

I found a simpler way of doing this. I copy the code module into Word,
then run a Search and Replace macro that reduces the document to just
the macronames, each name on a line, without the "Sub" or the "()".
Then using

X = Selection.Text

I create a loop in which the description for each macro is printed
using:

Selection.TypeText WordBasic.MacroDesc$(X)

Larry
 

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