I have a VB6 application that needs to call a Word 2010 VBA routine and supply a string parameter. The VBA routine is in an Addin that is enabled with the open document.
According to the MSDN reference (http://msdn.microsoft.com/en-us/library/ff838935.aspx) I should be able to supply that parameter after the macro name, in order.
My code calling the routine looks like so:
sMacro = "Link.Functions.UpdateFootnote"
sParam = "Footnote Text"
DocApp.Run sMacro, sParam
'I've also tried
DocApp.Run MacroName:=sMacro, varg1:=sParam
'and
DocApp.Run "Link.Functions.UpdateFootnote","Footnote Text"
In each case this yields run-time error 438, "Object doesn't support this property or method."
DocApp.Run "Link.Functions.UpdateFootnote, Footnote text"
This one gives Run-time error -2147352573(80020003) "Unable to run the specified macro"
As a check, I have a 2nd parameterless macro (that then calls the original macro) and it works fine.
DocApp.Run "Link.Functions.UpdateFootnoteTest"
What am I getting wrong here?