Replace existing command with add-in

  • Thread starter Kees van Amerongen
  • Start date
K

Kees van Amerongen

Is there a way to replace an existing command with an Word Add_in.
For example, i'd like to add code to the FileSaveAs command. With a macro i
could
make a macro and name it FileSaveAs and add my code. Can this be done with
an add-in.
I only see examples of add-in's where buttons are added and the code is
executed by the
buttonclick.


Kees van Amerongen
 
C

Chris Jensen [MSFT]

Hello Kees,

Definitely yes. Iterate through the commandbarpopups until you find the one
with the caption "File", or "&File",
then iterate through its commandbarbuttons until you find the one with the
caption "SaveAs" or "Save&As".
Change the properties of Enabled to false, and Visible to false. Then add
your own CommandBarButton with the appropriate caption and OnAction
properties.

You'll also need to either make the VBA module an AddIn that is opened from
the Startup folder, or a permanent part of Normal.Dot. If the Normal.Dot
gets corrupted for some other reason, and is deleted and auto-replaced by
Word, you'll lose that macro. So consider making it an AddIn.

However, this won't keep the Alt+F and the subsequent Alt+a keystrokes from
working on the original SaveAs commandbarbutton. You'll need to use the
OnKey events to capture those and call your macro.

An alternative is to use the ODMA interface that comes built into Word.
That hooks the Save and SaveAs commands so that you can replace or add to
their functionality. You can download more information, and the ODMA core
dll from the site at http://nfocentrale.net/dmware/

--------------------
From: "Kees van Amerongen" <[email protected]>
Subject: Replace existing command with add-in
Date: Tue, 5 Aug 2003 13:18:05 +0200
Is there a way to replace an existing command with an Word Add_in.
For example, i'd like to add code to the FileSaveAs command. With a macro i
could
make a macro and name it FileSaveAs and add my code. Can this be done with
an add-in.
I only see examples of add-in's where buttons are added and the code is
executed by the
buttonclick.


Kees van Amerongen

Regards,
Chris Jensen[MSFT]

This posting is provided “AS IS” with no warranties, and confers no rights.

“Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026?  If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
http://www.microsoft.com/security/security_bulletins/ms03-026.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to
insure you are current with all security patches, not just MS03-026.”
 

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