You need to load the form into memory, but not show it.
Sub AAA()
Load UserForm1
UserForm1.CommandButton1_Click
End Sub
In the userform's code module, change the command button's Click
procedure from Private to Public.
Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com