Can this be done? I think the standard AutoCorrect only works on whole words...
-
Not off topic if it's done via a VBA script.– user49841Feb 27, 2011 at 22:35
-
What about changing your keyboard layout to Swedish/German/SomeOtherLanguageWithUmlauts instead? :-)– Aasmund EldhusetFeb 27, 2011 at 22:36
-
11. This is off-topic. 2. I don't think there's something for this built-in. 3. What's wrong with search/replace ae->ä, oe->ö, ue->ü. I guess you can even write a macro for this. 4. Bad for words like "Aerodynamik" where you don't want it replaced...– schnaaderFeb 27, 2011 at 22:36
-
1@shnaader: I know from ExcelVBA that you can run a macro on a certain action (e.g., cursor leaves cell). Maybe something similar exists in word that can be applied here. My text will contain only very few 'false positives' such as Aerodynamik. I don't want to use search/replace, because the width of each word must be correct while I type.– FrankFeb 27, 2011 at 22:45
-
1Is there any reason that Ctrl+Shift+: (press all three of these, then let go and then press) + a is not being used if you want this as you type?– OtakuFeb 27, 2011 at 23:41
2 Answers
One solution: Bind wdKeyE
to the following macro
Sub my_e()
Select Case (Selection.Previous(wdCharacter, 1))
Case "a"
Selection.TypeBackspace
Selection.TypeText ChrW(228)
'other cases, as desired
Case Else
Selection.TypeText "e"
End Select
End Sub
The key binding can be done with:
KeyBindings.Add KeyCategory:=wdKeyCategoryMacro, Command:="my_e", KeyCode:=wdKeyE
And unbinding:
Sub e_unbind()
Dim cmds As Variant
Dim bind As KeyBinding
For Each bind In Application.KeyBindings
If bind.KeyCategory = wdKeyCategoryMacro Then
cmds = Split(bind.Command, ".")
If cmds(UBound(cmds)) = "my_e" Then bind.Clear
End If
Next
End Sub
...Works well so far
As this has been migrated to SuperUser, it seems reasonable to include some of the comments as an answer.
@Otaku noted that a combination of keys would produce the required accent, based on this comment I found a list that details the accents that can be added with key combinations and an English or US keyboard layout. This is apart from the accents that can be got by using Alt Gr.
-
@Otaku this really belongs to you, so if you wish to reply, I will delete this community response.– RemouFeb 28, 2011 at 11:36