I'm not a programmer but I wish to create a word 97 macro to change
the numeric decimal (the "." key) so it will print a comma. I have
found the way to do this on word 95 but it doesn't work on 97!
Thank you.
Ovide.
The simplest way is to create 2 macros as follows:
Sub AssignNumpadPeriodToComma()
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCategory:=wdKeyCategoryMacro, _
KeyCode:=BuildKeyCode(wdKeyNumericDecimal), _
Command:="TypeAComma"
End Sub
Sub TypeAComma()
Selection.TypeText ","
End Sub
Now run the first macro. If you're prompted to save changes to the
Normal template when you close Word, answer yes.
If and when you want to undo this change, you'll need to run another
macro:
Sub UnassignNumpadPeriodToComma()
FindKey(BuildKeyCode(wdKeyNumericDecimal)).Clear
End Sub
A cleaner way, which takes a bit more work in the beginning, is to
put these macros in a global add-in template (stored in the Word
Startup folder). In this case, you'd name the second one AutoExec
(so it'll run whenever the add-in is loaded [in this case, whenever
you open Word]). Also add the lines:
ThisDocument.Saved = True
StatusBar = "Custom key assignment loaded by MyKeys.dot " & _
"in the Word Startup folder."
to the end of that macro.
The advantages of doing it this way are:
1 - It avoids placing the customization in the Normal template.
2 - If someone else inherits your machine and is confused by the
funny way your numeric keypad behaves, the fact that you
have an add-in loaded and a StatusBar message that (softly)
announces it makes it a bit more obvious what's going on.
Disabling the custom key binding would require simply moving
or deleting the add-in.
If you choose not to do it this way and there's any chance your
customization will trip someone up, at least keep the 'Unassign'
macro named very descriptively.
Hope this helps a little.
-- Mark Tangard <mtan...@speakeasy.net>, MS Word MVP ---------------
-- See the MVP FAQ at http://www.mvps.org/word ----------------------
------------- "Life is nothing if you're not obsessed." --John Waters
---------------------------------------------------------------------
Please reply only to the newsgroup.
Thanks a lot, Mark!
Ovide.
Mark
FYI: By default, in the french version anyway, it's not checked.
Ovide.