Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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
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
command button code dummy Excel Discussion (Misc queries) 2 December 1st 09 02:57 PM
Code for my Command Button to automatically copy and insert a new tommy Excel Discussion (Misc queries) 0 January 28th 09 12:22 AM
Command button to toggle worksheet event code on / off? Fred[_2_] Excel Discussion (Misc queries) 15 July 31st 07 11:50 AM
VBA code behind command button [email protected] Excel Worksheet Functions 1 March 22nd 06 08:13 PM
Command Button VBA code Dave Peterson Excel Discussion (Misc queries) 2 January 25th 05 11:28 PM


All times are GMT +1. The time now is 05:10 AM.

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"