There is a thread on the Macro forum about using a macro to change the macro that is the default macro behind the label or code and that has prompted me to start this thread.
The following code and macro changed the default macro
With Forms("MasterForm").Controls("Command1571")
If .OnClick = "Macro1477" Then
.OnClick = "Macro1162"
End If
End With
And a SetValue macro action
Item [Forms]![MasterForm]![Command1571].[OnClick]
Expression "Macro1162"
I got the code from this site
http://msdn.microsoft.com/en-us/library/aa172963(office.11).aspx
The only way I can think of to change the code behind a label or button (and hence my question) would be to have the code in a module and a macro with a RunCode action line.
If the macro name to be inserted could be taken from a text box on a tabular form or a combo.....and descriptiopn of what it did...then I think that would be neat.
But would there be someway that the actual code behind the button or label could be changed?
The following code and macro changed the default macro
With Forms("MasterForm").Controls("Command1571")
If .OnClick = "Macro1477" Then
.OnClick = "Macro1162"
End If
End With
And a SetValue macro action
Item [Forms]![MasterForm]![Command1571].[OnClick]
Expression "Macro1162"
I got the code from this site
http://msdn.microsoft.com/en-us/library/aa172963(office.11).aspx
The only way I can think of to change the code behind a label or button (and hence my question) would be to have the code in a module and a macro with a RunCode action line.
If the macro name to be inserted could be taken from a text box on a tabular form or a combo.....and descriptiopn of what it did...then I think that would be neat.
But would there be someway that the actual code behind the button or label could be changed?