Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting .OnAction of a command button terminates my macro.....
I am adding buttons to a spreadsheet programmatically and stepping
through the macro, it gets to the line ActiveSheet.Buttons("Survey").OnAction = "SCI" and the macro ends. The OnAction has been set but the macro will not carry on after that. No error message, nothing. I need to set the onactions of many buttons but cannot get past the first one. Anyone got any ideas? Using Excel 2002. Many thanks, Ian |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting .OnAction of a command button terminates my macro.....
Hi Ian,
I see nothing contentious in the code snippet. Post the following code which does not run. --- Regards, Norman wrote in message oups.com... I am adding buttons to a spreadsheet programmatically and stepping through the macro, it gets to the line ActiveSheet.Buttons("Survey").OnAction = "SCI" and the macro ends. The OnAction has been set but the macro will not carry on after that. No error message, nothing. I need to set the onactions of many buttons but cannot get past the first one. Anyone got any ideas? Using Excel 2002. Many thanks, Ian |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting .OnAction of a command button terminates my macro.....
Hi Norman,
Here is the full code: Sub Splash_Screen() Sheets.Add befo=Sheets(1) Sheets(1).Name = "Navigation" Cells.Select With Selection.Interior .ColorIndex = 15 .Pattern = xlSolid End With ActiveSheet.Buttons.Add(50, 50, 100, 50).Name = "Survey" ActiveSheet.Buttons("Survey").Caption = "Survey" ActiveSheet.Buttons("Survey").OnAction = "SCI" ActiveSheet.Buttons.Add(200, 50, 100, 50).Name = "Prices" ActiveSheet.Buttons("Survey").Caption = "Prices" ActiveSheet.Buttons("Survey").OnAction = "Prices" Range("A1").Select End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting .OnAction of a command button terminates my macro.....
Hi Ruff,
Your code ran for me. You should, however, change: ActiveSheet.Buttons("Survey").Caption = "Prices" ActiveSheet.Buttons("Survey").OnAction = "Prices" to: ActiveSheet.Buttons("Prices").Caption = "Prices" ActiveSheet.Buttons("Prices").OnAction = "Prices" Subject to this change, your macro achieved, for me, all that you asked of it. --- Regards, Norman "ruff" wrote in message oups.com... Hi Norman, Here is the full code: Sub Splash_Screen() Sheets.Add befo=Sheets(1) Sheets(1).Name = "Navigation" Cells.Select With Selection.Interior .ColorIndex = 15 .Pattern = xlSolid End With ActiveSheet.Buttons.Add(50, 50, 100, 50).Name = "Survey" ActiveSheet.Buttons("Survey").Caption = "Survey" ActiveSheet.Buttons("Survey").OnAction = "SCI" ActiveSheet.Buttons.Add(200, 50, 100, 50).Name = "Prices" ActiveSheet.Buttons("Survey").Caption = "Prices" ActiveSheet.Buttons("Survey").OnAction = "Prices" Range("A1").Select End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting .OnAction of a command button terminates my macro.....
Thanks Norman. I restarted Excel and it appears to work now. Very
strange! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
OnAction - Adding a command bar | Excel Programming | |||
setting a command button to be a hyperlink | Excel Programming | |||
macro terminates with no error | Excel Programming | |||
Propblem setting OnAction property at runtime | Excel Programming | |||
OnAction command failure | Excel Programming |