Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Create a Macro...

0 views
Skip to first unread message

Ovide Plouffe

unread,
Oct 18, 2001, 11:24:54 AM10/18/01
to
Hi all,

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.

Mark Tangard

unread,
Oct 20, 2001, 3:17:00 AM10/20/01
to
Hi 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.

Ovide Plouffe

unread,
Oct 22, 2001, 9:50:26 AM10/22/01
to
It's working perfectly... But it didn't ask me to Save changes to
Normal.Dot template. Anyway, when I reopened my word it was still
working.

Thanks a lot, Mark!

Ovide.

Mark Tangard

unread,
Oct 22, 2001, 6:57:49 PM10/22/01
to

The prompt to save changes will appear if you have 'Prompt To Save
Normal Template' checked in Tools-> Options-> Save. I don't even
remember anymore if it's checked by default. Anyway, that's why I
mentioned it.

Mark

Ovide Plouffe

unread,
Oct 23, 2001, 10:27:06 AM10/23/01
to
Hi Mark,

FYI: By default, in the french version anyway, it's not checked.

Ovide.

0 new messages