views:

8

answers:

1

I'm trying to create a fairly simple macro in Word 2010 using Visual Basic. All it needs to do is press Alt+F7 to select the closest spelling error, then press Enter to choose the first spelling suggestion, then press Shift+F5 to return to the previous edit point. I tried this:

SendKeys "%{F7}"
SendKeys "~"
SendKeys "+{F5}"

but the context menu that pops up after %{F7} disappears immediately so it doesn't receive the Enter key press. Instead, the selected text gets replaced with a line break. Any suggestions? I perform this sequence of key presses a lot when typing, so it would great if I could automate it.

+1  A: 

well, I found a bit of a workaround that works:

SendKeys "{F7}{TAB}{TAB}{TAB}{TAB}{TAB}~{ESCAPE}+{F5}+{F5}"

but the dialog that pops up and the iterating through buttons is slower and clumsier than I'd like. Any better ideas would be greatly appreciated.

Sunian314