Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Change 'Caption' on ToggleButtons with VBA

It depends on whether you are using the one from the Forms Toolbar or the one
from the Control Toobox. Check in VBA help by typing "Caption property" in
the search box and it will bring up a menu with two or three references that
will help you decide.

"Jay" wrote:

Hi all -

The following procedure works propertly, adding two toggle buttons to the
active sheet:

Sub addToggles()
Dim oleObj As OLEObject
Set oleObj = ActiveSheet.OLEObjects.Add _
(ClassType:="Forms.ToggleButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=0.75, Top:=243, Width:=72, _
Height:=30.75)
Set oleObj = ActiveSheet.OLEObjects.Add _
(ClassType:="Forms.ToggleButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=74.25, Top:=243, Width:=72, _
Height:=30.75)
End Sub

What is the syntax for changing the button 'captions' from "ToggleButton1"
to "Start Date" and "ToggleButton2" to "End Date" ?

Thie following 'caption' statement doesn't work seemingly because these
buttons are on the worksheet (not on a user form):
Activesheet.ToggleButton1.Caption = "Start Date".
--
Thanks for any advice,
Jay

  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Change 'Caption' on ToggleButtons with VBA

Hi JLGWhiz -

Your suggestion led to excellent information and another link that was
useful, too. Search VBA's Online Help system for Using "ActiveX Controls on
Sheets". This provides links to additional fundamentals of working with
objects.

Your reminder to lean on VBA Help along with Greg's code sample opened the
door to a better understanding of objects.

-----
Thanks,
Jay


"JLGWhiz" wrote:

It depends on whether you are using the one from the Forms Toolbar or the one
from the Control Toobox. Check in VBA help by typing "Caption property" in
the search box and it will bring up a menu with two or three references that
will help you decide.

"Jay" wrote:

Hi all -

The following procedure works propertly, adding two toggle buttons to the
active sheet:

Sub addToggles()
Dim oleObj As OLEObject
Set oleObj = ActiveSheet.OLEObjects.Add _
(ClassType:="Forms.ToggleButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=0.75, Top:=243, Width:=72, _
Height:=30.75)
Set oleObj = ActiveSheet.OLEObjects.Add _
(ClassType:="Forms.ToggleButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=74.25, Top:=243, Width:=72, _
Height:=30.75)
End Sub

What is the syntax for changing the button 'captions' from "ToggleButton1"
to "Start Date" and "ToggleButton2" to "End Date" ?

Thie following 'caption' statement doesn't work seemingly because these
buttons are on the worksheet (not on a user form):
Activesheet.ToggleButton1.Caption = "Start Date".
--
Thanks for any advice,
Jay

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Change 'Caption' on ToggleButtons with VBA

Thanks for the feedback, Jay. I learned in the military that when all else
fails, read the instructions. I rely on the help files quite a bit. Only a
few times that I could not work out the answers. But when you are in a
hurry, don't hesitate to post here where there is a world of experience
available to you.

"Jay" wrote:

Hi JLGWhiz -

Your suggestion led to excellent information and another link that was
useful, too. Search VBA's Online Help system for Using "ActiveX Controls on
Sheets". This provides links to additional fundamentals of working with
objects.

Your reminder to lean on VBA Help along with Greg's code sample opened the
door to a better understanding of objects.

-----
Thanks,
Jay


"JLGWhiz" wrote:

It depends on whether you are using the one from the Forms Toolbar or the one
from the Control Toobox. Check in VBA help by typing "Caption property" in
the search box and it will bring up a menu with two or three references that
will help you decide.

"Jay" wrote:

Hi all -

The following procedure works propertly, adding two toggle buttons to the
active sheet:

Sub addToggles()
Dim oleObj As OLEObject
Set oleObj = ActiveSheet.OLEObjects.Add _
(ClassType:="Forms.ToggleButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=0.75, Top:=243, Width:=72, _
Height:=30.75)
Set oleObj = ActiveSheet.OLEObjects.Add _
(ClassType:="Forms.ToggleButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=74.25, Top:=243, Width:=72, _
Height:=30.75)
End Sub

What is the syntax for changing the button 'captions' from "ToggleButton1"
to "Start Date" and "ToggleButton2" to "End Date" ?

Thie following 'caption' statement doesn't work seemingly because these
buttons are on the worksheet (not on a user form):
Activesheet.ToggleButton1.Caption = "Start Date".
--
Thanks for any advice,
Jay

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
Moving togglebuttons Fugazy Excel Discussion (Misc queries) 0 August 15th 06 02:54 PM
Commandbutton caption change peter.thompson[_6_] Excel Programming 6 December 22nd 05 06:29 AM
How to change Button Caption? BrianB Excel Programming 3 June 1st 05 06:24 PM
change the value of togglebuttons Nelson Excel Programming 1 November 10th 04 04:17 AM
ToggleButtons are strange Ken McLennan[_3_] Excel Programming 7 October 11th 04 09:40 AM


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