Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default code to add control to a worksheet

I know that:
Set Mycmd = Controls.Add("MSForms.CommandButton.1") ', CommandButton2,
Visible)
will add a control to a form

what would the code be to add a control to a worksheet? (are there any
tricks I will need to do to make it functional (de-activate / activate
worksheet...))

thanks in advance
mark


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default code to add control to a worksheet

When in doubt, record a macro that does what your trying to accomplish, then
edit the code to suit your needs, great way to learn and help you remember
long forgotten functionality. This is what recorded when I added a button.
Can't get much better.

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Comma ndButton.1", Link:=False _
, DisplayAsIcon:=False, Left:=79.5, Top:=135.75, Width:=64.5, Height _
:=25.5).Select

-John


"mark kubicki" wrote:

I know that:
Set Mycmd = Controls.Add("MSForms.CommandButton.1") ', CommandButton2,
Visible)
will add a control to a form

what would the code be to add a control to a worksheet? (are there any
tricks I will need to do to make it functional (de-activate / activate
worksheet...))

thanks in advance
mark



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
c# code to add button control to the worksheet!!!! .NetProf Excel Programming 0 January 30th 06 04:45 AM
Reference to ActiveX control on worksheet requires full worksheet name Ian Ripsher[_5_] Excel Programming 3 June 25th 05 04:22 PM
Design Best Practices: Form Control Code in Worksheet or Module Bing Excel Programming 2 December 23rd 04 02:31 PM
Changing control properties/code through code Ajit Excel Programming 3 October 18th 04 09:03 PM
can you control SAP with VBA code? robin Excel Programming 0 October 9th 03 06:40 PM


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