LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Propblem setting OnAction property at runtime

Hi,

I am using Excel 2000.

I create command buttons at runtime like this:
Code snippet

For iIndx = 2 To 24 Step 4
If Cells(14, iIndx).Value < "" Then
iBtn = iBtn + 1
Set xBtnShape = Distribution.Shapes.AddOLEObject( _
Left:=Range(Cells(1, iIndx).Address).Left, _
Top:=Range(Cells(1, iIndx).Address).Top, _
Width:=150, _
Height:=24, _
ClassType:="Forms.CommandButton.1")

With Distribution.OLEObjects(Distribution.OLEObjects.Co unt).Object
.Caption = "Update Distribution Class " & iBtn
End With
end if

next
<<<< END CODE <<<<<

so, this works fine, I get a new button in the right column for each column that has a value in the cell checked by the If... statement.

It then changes the caption fine.

My problem is that I cannot set the OnAction property. Using this code I want to point all my buttons at one global procedure that will check the Application.Caller value and do what is required.

Unfortunately it always gives an Application or Object defined error...

anyone had this before?

thanks

Philip
 
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
Passing several parameters to OnAction property. LABKHAND Excel Discussion (Misc queries) 1 April 24th 09 08:02 PM
DrawingObjects/AutoShapes' .OnAction property in DialogSheets BizMark Excel Discussion (Misc queries) 0 October 12th 05 12:40 PM
Capturing Shape Name/Text from OnAction property William Bartusek Excel Discussion (Misc queries) 3 April 12th 05 06:38 PM
unable to set the OnAction Property of the Text Box Russell Harris Excel Programming 1 December 10th 03 12:52 AM
Find OnAction property Kemosabe Excel Programming 1 November 21st 03 03:34 PM


All times are GMT +1. The time now is 06:47 AM.

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

About Us

"It's about Microsoft Excel"