2014-03-05 106 views
1

我有一個快速運行簡單拼寫檢查對話的Word 2013宏。在按鍵處運行宏 - 空格鍵

我想在每次輸入單詞時運行它。

這樣做的一種方法是每次按空間時運行宏。

因此,我嘗試使用選項>自定義功能區>鍵盤快捷鍵方法,但該功能對空格鍵不起作用。

我怎樣才能運行一個宏,每次按「空間」鍵?

預先感謝您。

+0

你想'自動更正'幾句話? –

+0

我正在嘗試製作一個有點像'IOS AutoCorrect'系統的宏 – Carl479

回答

1

你應該可以使用KeyBindings來做到這一點。我沒有用空格鍵試了一下具體的,但我用這個與選項卡,退格等的基本思路是:

在子你在啓動或文檔打開運行:

'This line may differ depending on whether you are running this from a document template or an add-in. 
Application.CustomizationContext = ThisDocument.AttachedTemplate 
' Create the keybinding. 
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeySpacebar), KeyCategory:= _ 
     wdKeyCategoryMacro, Command:="MyMacro" 

然後確保您的宏被命名爲與您在Command中放置的任何內容相匹配。