ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unknown Error Message (https://www.excelbanter.com/excel-programming/284994-unknown-error-message.html)

S. S.

Unknown Error Message
 
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

Tom Ogilvy

Unknown Error Message
 
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"

--
Regards,
Tom Ogilvy



"S. S." wrote in message
...
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





All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com