Reverse 2 Letters Macro (v9.2) in Word Mac

Hello,

My macro "Reverse 2 Letters Macro (v9.2)" works fine except in Word Mac where it times out after the 2nd step. How to fix?

Your help will be appreciated!

Michael

You might give Super Swap Macro a try.

Thanks! Do I copy and paste of is there a better way to get it?

Just find the (blue) link in the post and click to download. Then double-click the download to install:

ss-67

Clicking on it takes me to Keyboard Maestro 8.0.4 “Super Swap” Macro, but nothing downloads.

Right. Then scroll down until you see what's in that screen shot ("ACKNOWLEDGEMENT" etc.), which is where the link is on that page.

Got it. Thanks!

When I attempt to switch to letter, it deletes the 2 letter to the left of my cursor. Same thing if I select 2 letters.

How to fix?

I don't use Word but it works in LibreOffice. It is very slow to paste in the second character so it may be that Word requires a Pause action between one of those last two (or both) actions at the end of the macro.

This one works both ways (without selecting the two characters and by selecting them) in LibreOffice. And at normal speed, too.

Let me know if it works in Word, please? (And which version of Word.)

Super Swap II Macro (v9.2)

Super Swap II.kmmacros (15 KB)

Here's a second version tailored for LibreOffice without penalizing everything else. If you're using Word, you can add Word (or change LibreOffice to Word where you see it).

The trick for selections seems to be to use By Typing rather than By Pasting although for the non-selection swap (at the bottom) I simply updated to the built-in commands rather than use the keystrokes (best practices, in short).

Super Swap II.kmmacros (16 KB)

Mike, I'm sorry to say that Super Swap II doesn't work in Word either. I do appreciate the time you've spent on this though.

I suspect you're on a pc. I'm on a Mac. Could that be a problem?

No, Keyboard Maestro only runs on a Mac.

If you selected the two characters (or words) to swap, there is nothing I can think of to improve the macro.

But if you just placed the cursor in front of the two characters to swap, you do have to make a change to the macro for Word (which I don't have so can't do for you). Note where it says "LibreOffice" in the purple action and pop that up to change it to "Word" and then try the macro"

ss-68

Otherwise, sorry I can't help. I suspect the issue has to do with what Word puts in the Clipboard.

I would use Word VBA macro for this purpose.

@mfbroom, here's a MS Word VBA macro that works for me:

Sub Swap_Words()
'
' Swap_Words Macro
'
'
    Dim selRng As Range
    
    Selection.Copy
    Set selRng = Selection.Range
    word1 = selRng.Words(1)
    word2 = selRng.Words(2)
    newWords = Trim(word2) & " " & Trim(word1)
   ' Debug.Print newWords
    Selection.Text = newWords
    
End Sub