I'm getting "Object variable or with block variable not set" (Error 91) on the below mentioned line.
Set cmd = ActiveWorkbook.VBProject.VBComponents("UserForm1").Designer.Controls.Add("Forms.CommandButton.1", "cmdTst")
where cmd is defined as
Dim cmd As MSForms.CommandButton

It looks like you're trying to run your code within the UserForm code module. However, as @CDP1802 has already mentioned, you'll need to run the code within a regular module. Then, once your code adds the CommandButton, you'll need to add the UserForm to the UserForms collection, and invoke the Show method, if you want to show your UserForm.