View VBA for built-in macros?

P

pjs

As a way to teach myself VBA, I thought it would be helpful to view the code
for some of the various built-in Word macros, like Word Count or EditReplace.

Is there an easy way to do this? I know how to see the built-in macro names
(Tools ---> Macro ---> Macros, choose Macros in Word Commands). But there
doesn't seem to be a way to view the associated code.

Thanks,

pjs
 
J

Jay Freedman

pjs said:
As a way to teach myself VBA, I thought it would be helpful to view
the code for some of the various built-in Word macros, like Word
Count or EditReplace.

Is there an easy way to do this? I know how to see the built-in macro
names (Tools ---> Macro ---> Macros, choose Macros in Word Commands).
But there doesn't seem to be a way to view the associated code.

Thanks,

pjs

No, the code for the built-in commands isn't VBA. It's compiled into the
Word program itself.

Although you can intercept and override a built-in command by naming your
macro the same as the command
(http://www.word.mvps.org/FAQs/MacrosVBA/InterceptSavePrint.htm), that
doesn't tell you anything about how the built-in command works.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
F

Francine

Try this

This example creates a new document that lists all Word commands along with
their associated shortcut keys and menu assignments. The example then prints
and closes the new document without saving changes.

Application.ListCommands ListAllCommands:=True
With ActiveDocument
.PrintOut
.Close SaveChanges:=wdDoNotSaveChanges
End With
 

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