1

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. – user49841 Feb 27 '11 at 22:35
  • What about changing your keyboard layout to Swedish/German/SomeOtherLanguageWithUmlauts instead? :-) – Aasmund Eldhuset Feb 27 '11 at 22:36
  • 1
    1. 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... – schnaader Feb 27 '11 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. – Frank Feb 27 '11 at 22:45
  • 1
    Is 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? – Otaku Feb 27 '11 at 23:41
1

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

|improve this answer|||||
0

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.

|improve this answer|||||
  • @Otaku this really belongs to you, so if you wish to reply, I will delete this community response. – Remou Feb 28 '11 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.