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 do you define SpinButtons??

I have used the control toolbox to create a series of radio buttons. For one
of the radio buttons, when i click on it I want it to creat an OLEobject. I
created a privet sub program like the one below:

Private Sub Warrior_Click()

ActiveSheet.OLEObjects.Add(ClassType:="Forms.SpinB utton.1", Link:=False, _
DisplayAsIcon:=False, Left:=601.5, Top:=282, Width:=27, Height _
:=11.25).Select

End Sub

When I use the radio button it goes ahead and makes this spinbutton,
however, the spinbutton gets set to the default name "SpinButton1" and also
the defalt Max which is 100. I would like to create the spinbutton and set
the name and max number to what I want. How do you do this? Is it possible?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default How do you define SpinButtons??

"Skyhouse71" wrote:
Private Sub Warrior_Click()

ActiveSheet.OLEObjects.Add(ClassType:="Forms.SpinB utton.1", Link:=False, _
DisplayAsIcon:=False, Left:=601.5, Top:=282, Width:=27, Height _
:=11.25).Select
End Sub

When I use the radio button it goes ahead and makes this spinbutton,
however, the spinbutton gets set to the default name "SpinButton1" and also
the defalt Max which is 100. I would like to create the spinbutton and set
the name and max number to what I want. How do you do this? Is it possible?


It's a little tricky dealing with spreadsheet controls through the OLEObject
container. Does this get close to what you're looking for?

Private Sub Warrior_Click()
Dim NewOLESpinner As OLEObject
Dim TheSpinner As MSForms.SpinButton

Set NewOLESpinner = ActiveSheet.OLEObjects.Add( _
ClassType:="Forms.SpinButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=601.5, Top:=282, _
Width:=27, Height:=11.25)

' pull the spinner object out of the OLE container
Set TheSpinner = NewOLESpinner.Object
' rename the spinner, set its .Max
TheSpinner.Name = "sheetSpinnerName"
TheSpinner.Max = 50
TheSpinner.LinkedCell = "A5" ' etc.
End Sub

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
Define Name rml Excel Worksheet Functions 5 November 9th 06 01:33 PM
Name Define Ken Johnston Excel Discussion (Misc queries) 6 January 8th 06 03:04 PM
Define name Q Benjamin Excel Discussion (Misc queries) 3 October 19th 05 01:29 PM
define name sunshine Excel Discussion (Misc queries) 1 March 29th 05 01:37 AM
Name define Alexander[_4_] Excel Programming 3 December 31st 03 02:16 PM


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