M
Michael Pollard
I am trying to assign a RunMacro formula to an action cell, but it seems to
try to evaluate the RunMacro rather than assigning the string.
The formula works for a "EventDblClick", but not for
"Actions.<action>.Action", because it has to be slightly different
syntactically. The Action wants no surrounding quotation marks and only
single embedded quotes, which is different than a regular formula such as the
Event accepts.
But the formula the Action wants seems to be blocked by VBA, as it seems to
want to evaluate it rather than just copy it.
Specifically:
Code: MyObject.CellsU("EventDblClick").Formula =
StringToFormula("RunMacro(""MacroName"")")
Results, in the cell: ="RunMacro(""MyMacro"")"
This works.
Code: MyObject.CellsU("Actions.<action>.Action").FormulaU =
StringToFormula("RunMacro(""MyMacro"")")
Results: ="RunMacro(""MyMacro"")"
The results are the same as before, but this doesn't work. When I select the
action, nothing happens.
If I manually edit the cell to: =RunMacro("MyMacro")
this works.
So I try to programatically insert it.
Code: CurrentObject.CellsU("Actions.Select.Action").Formula =
StringToFormula("RunMacro("MyMacro")")
but this gives: "Compile error: Expected: list separator or )"
Any ideas? (RunMacro has very limited documentation...)
try to evaluate the RunMacro rather than assigning the string.
The formula works for a "EventDblClick", but not for
"Actions.<action>.Action", because it has to be slightly different
syntactically. The Action wants no surrounding quotation marks and only
single embedded quotes, which is different than a regular formula such as the
Event accepts.
But the formula the Action wants seems to be blocked by VBA, as it seems to
want to evaluate it rather than just copy it.
Specifically:
Code: MyObject.CellsU("EventDblClick").Formula =
StringToFormula("RunMacro(""MacroName"")")
Results, in the cell: ="RunMacro(""MyMacro"")"
This works.
Code: MyObject.CellsU("Actions.<action>.Action").FormulaU =
StringToFormula("RunMacro(""MyMacro"")")
Results: ="RunMacro(""MyMacro"")"
The results are the same as before, but this doesn't work. When I select the
action, nothing happens.
If I manually edit the cell to: =RunMacro("MyMacro")
this works.
So I try to programatically insert it.
Code: CurrentObject.CellsU("Actions.Select.Action").Formula =
StringToFormula("RunMacro("MyMacro")")
but this gives: "Compile error: Expected: list separator or )"
Any ideas? (RunMacro has very limited documentation...)