I'm trying to figure out why I cannot run a Microsoft Word macro called from a VSTO add-in written in VB. Every reference I can find says you can do this with a one-liner:
Application.Run("MacroName")
The macro itself is very simple...it just toggles the 'replace text as you type' setting (AutoCorrect.ReplaceText = Not AutoCorrect.ReplaceText). This runs perfectly when invoked from Word itself. The macro is linked to the normal.dotm template so it's available whenever Word is opened. I'm using a button on the Word ribbon with a callback to a function that in-turn calls the macro.
Public Function DisplayHelp(ByVal control As Office.IRibbonControl)
'On Error Resume Next
Dim wdApp As New Microsoft.Office.Interop.Word.Application
wdApp.Run("AC_Test")
UpdateLabel()
End Function
Clicking the button does not change the state of the replace text setting. I'm somewhat inexperienced at add-in development so appreciate any suggestions.
Thanks