Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Create Command Button from Code
Thanks John! I decided to use the Forms command button. I added the following code: Sub Macro8() ActiveSheet.Buttons.Add(100, 40, 78.75, 27.75).Select Selection.Name = "x" Selection.Caption = "xxxxxx" Selection.OnAction = "subX" End Sub Sub subX() Debug.Print "x" End Sub This works fine. However, how do I reference the button or find out property values? I tried several things in subX, such as: Debug.Print "cap: " & x.Caption but got an error. I tried called using: subX(Me) sub subX(byval o as object) 'and as commandbutton but still got error (object related). Do you know how I can do this? Thanks again. - Bruce *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
command button code | Excel Discussion (Misc queries) | |||
Code for my Command Button to automatically copy and insert a new | Excel Discussion (Misc queries) | |||
Command button to toggle worksheet event code on / off? | Excel Discussion (Misc queries) | |||
VBA code behind command button | Excel Worksheet Functions | |||
Command Button VBA code | Excel Discussion (Misc queries) |