Unknown Error Message

  • Thread starter Thread starter S. S.
  • Start date Start date
S

S. S.

I am running the following code:

ActiveSheet.Buttons.Add(481.5, 15, 87.75, 47.25).Select
Selection.OnAction = "ThisWorkbook.CommandButton1_Click"
Selection.Characters.Text = "Sort and Print"

Whenever the action gets to this part of the code it
creates an error message that says "400". Does anyone
know what this means?

Thanks

SS
 
You adding a button from the forms toolbar and tying it to a event macro for
a control toolbox toolbar commandbutton. You should rename you macro and
put it in a general module. Assume the macros name is

Sub btn_click()

End sub

Dim btn as Button
set btn = ActiveSheet.Buttons.Add(481.5, 15, 87.75, 47.25)
btn.OnAction = "btn_click"
btn.Caption = "Sort and Print"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top