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: 553
Default Add Button at Run-time in Code

I am trying to add a button to a Form in code. When I run the code below the
form shows without a button on it. Why is this?

Dim NewBttn As MSForms.CommandButton

Set NewBttn = UserForm1.Controls.Add("forms.CommandButton.1")
NewBttn.Top = FirstRowSquareTop * Counter
NewBttn.Left = FirstRowSquareLeft * Counter
NewBttn.Width = FirstRowWidth * Counter
NewBttn.Visible = True
'Set NewBttn = Nothing

UserForm1.Show
End Sub
 
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 to assign same code inside Option button code space ?? furbiuzzu Excel Programming 1 November 21st 06 02:36 PM
Adding Code to Command Button Added At Run Time Kevin E. Excel Programming 2 October 18th 06 04:11 PM
Adding Code to Command Button at Run Time Kevin E. Excel Programming 1 September 20th 06 12:25 AM
Hit a button with VBA code [email protected] Excel Programming 2 March 6th 06 02:32 PM
How to make a button VBA code reference other VBA code subroutines??? gunman[_9_] Excel Programming 4 September 27th 05 01:01 AM


All times are GMT +1. The time now is 01:31 PM.

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"