Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnAction - Adding a command bar DejaVu[_8_] Excel Programming 4 June 6th 05 04:34 PM
setting a command button to be a hyperlink neowok[_70_] Excel Programming 0 July 15th 04 04:55 PM
macro terminates with no error pH7[_3_] Excel Programming 3 April 26th 04 08:49 PM
Propblem setting OnAction property at runtime Philip Excel Programming 2 January 26th 04 05:51 PM
OnAction command failure [email protected] Excel Programming 4 November 18th 03 07:50 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"