Word remap Ctrl+S

B

betrosc

Hi,

I am wanting to remap the MSWord 2002 save shortcut Ctrl+S so that when
a user presses the Ctrl+S instead of doing a save it runs my code and i
choose to do the save or not.
The code i currently have is :

....
Private WithEvents objWordApp As Word.Application
....

objWordApp.CustomizationContext = objWordApp.ActiveDocument
objWordApp.KeyBindings.Add(Word.WdKeyCategory.wdKeyCategoryMacro,
"TestIt", objWordApp.BuildKeyCode(Word.WdKey.wdKeyControl.wdKeyControl,
Word.WdKey.wdKeyControl.wdKeyS))

....

Private Sub TestIt()
messagebox.show("in here")
End Sub


The error message that comes up is :

"Word cannot change the function of ther specified key"

Can anyone offer some suggestions.

Thanks

Clinton
 
J

Jean-Guy Marcil

(e-mail address removed) was telling us:
(e-mail address removed) nous racontait que :
Hi,

I am wanting to remap the MSWord 2002 save shortcut Ctrl+S so that
when a user presses the Ctrl+S instead of doing a save it runs my
code and i choose to do the save or not.
The code i currently have is :

To make sure that your code is executed whenever a user tries to save your
document, create two Subs named exactly as follows and from each one, call
the third sub that contains your code:

Sub FileSave()
MyCodeToExecute
End Sub


Sub FileSaveAs()
MyCodeToExecute
End Sub

Sub MyCodeToExecute()
'Your code
End Sub

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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