Try this.
Change the code behind the Click event of your command button from, say,
"Private Sub MyButton_Click()" to "Public Sub MyButton_Click()" then use the
line following to execute the code from, say, a module -
Form_MyForm.MyButton_Click (where "MyForm" is the name of your form)
The form does NOT have to be open.