Question : Create a Macro from code

I would like to create a macro from code.  I need to create a macro, put in a condition and an action.  I can do it with mickey mouses run command and send keys (See below), but there has to be a better way.

50 points for good help, 100 points for a complete function.

Thanks in advance for helping
LJG

Code I do not like:
Function MakeMacro()

    DoCmd.RunCommand acCmdNewObjectMacro
    SendKeys "AAAA~", False
    DoCmd.RunCommand acCmdSave
   
   'Put in Condition
    SendKeys "{RIGHT}1=1", True
   'Put in Action
    SendKeys "{RIGHT}OpenForm", True
   
    DoCmd.Close acMacro, "AAAA"

End Function

PS - I know I'll get the question why I would ever use a macro instead of code.  The answer is:
I have created a message box builder for Access where you can create a formatted message for the user.  I am going to give it away at a users group, where some of the people only know how to use macros.  If I can develop the code to optionally create a macro to run the code, it becomes valuable to everyone at the SIG.

Answer : Create a Macro from code

Sorry,  I was intrigued by the challenge, but I could not make it work.... it seems that they did not build as robust a model for the Macro class as some others.  What we would normally do with a Collection or an Object in VBA is not available for Macros...

Best of luck,

Tim
Random Solutions  
 
programming4us programming4us