Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default HOW CAN I WRITE A CODE TO A COMMANDBUTTON CREATED PROGRAMMATICALLY

My first question is how can I write a code to A CommandButton added by the
code below.

Private Sub Workbook_Open()

Set MyCommandButton = UserForm1.Controls.Add
("Forms.CommandButton.1", "CommandButton1" )

End Sub


My second question is, is there a way to create a UserForm programmatically?
(As my project above, I had to create a UserForm manually first and then
invoked the code above to add a CommandButton to my UserForm.)


--
Kozete
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rui Rui is offline
external usenet poster
 
Posts: 7
Default HOW CAN I WRITE A CODE TO A COMMANDBUTTON CREATED PROGRAMMATICALLY

Kozete

Have a look at this page as I think it will answer both your questions.

http://www.tek-tips.com/faqs.cfm?fid=5757

Cheers
Rui

"Kozete" wrote:

My first question is how can I write a code to A CommandButton added by the
code below.

Private Sub Workbook_Open()

Set MyCommandButton = UserForm1.Controls.Add
("Forms.CommandButton.1", "CommandButton1" )

End Sub


My second question is, is there a way to create a UserForm programmatically?
(As my project above, I had to create a UserForm manually first and then
invoked the code above to add a CommandButton to my UserForm.)


--
Kozete

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
HOW CAN I WRITE A CODE TO COMMANDBUTTON ADDED AT RUNTIME? Kozete Excel Programming 2 June 6th 08 05:22 PM
problem with Excel file created programmatically bill Excel Programming 3 January 27th 08 10:58 PM
CommandButton - Created using Forms toolbar JMay Excel Discussion (Misc queries) 9 January 24th 07 02:11 PM
use vba to write vba for a chart sheet created on the fly [email protected] Excel Programming 1 February 24th 06 09:01 PM
Data from Programmatically created Excel into SQL Server Raj Excel Programming 0 January 20th 05 10:03 PM


All times are GMT +1. The time now is 01:18 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"