Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default programatically reference controls on spreadsheet

i am trying to loop through all the controls on a spreadsheet and set certain
properites. In a userform, i am able to accomplish this with the following
code
~ for each control
~userform.controls("button"&i).caption="asdf"

however, i am at a lose as to how to loop through the controls placed
directly on a worksheet as opposed to the userform.

any help would be appreciated

thks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default programatically reference controls on spreadsheet

Dim ctl as Object
For each ctl in ActiveSheet.Shapes
MsgBox ctl.Name
Next

This seems to work for both "Forms" Toolbar created Items and "Control
Toolbox" created items.
--
Charles Chickering

"A good example is twice the value of good advice."


"k2sarah" wrote:

i am trying to loop through all the controls on a spreadsheet and set certain
properites. In a userform, i am able to accomplish this with the following
code
~ for each control
~userform.controls("button"&i).caption="asdf"

however, i am at a lose as to how to loop through the controls placed
directly on a worksheet as opposed to the userform.

any help would be appreciated

thks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default programatically reference controls on spreadsheet

Charles,

many thanks. With this method, i am having problems modifying the properties
of the 'toggle bar' for example the code me.ctl.caption="test"? any help
would be appreciated. thanks ken

"Charles Chickering" wrote:

Dim ctl as Object
For each ctl in ActiveSheet.Shapes
MsgBox ctl.Name
Next

This seems to work for both "Forms" Toolbar created Items and "Control
Toolbox" created items.
--
Charles Chickering

"A good example is twice the value of good advice."


"k2sarah" wrote:

i am trying to loop through all the controls on a spreadsheet and set certain
properites. In a userform, i am able to accomplish this with the following
code
~ for each control
~userform.controls("button"&i).caption="asdf"

however, i am at a lose as to how to loop through the controls placed
directly on a worksheet as opposed to the userform.

any help would be appreciated

thks

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
Programatically access Excel 2003 spreadsheet Edward Diener Excel Programming 3 August 8th 06 03:28 PM
Adding a reference programatically Fred Excel Programming 10 April 29th 06 12:55 AM
how to access programatically added controls don bowyer Excel Programming 3 August 8th 04 11:28 AM
Programatically saving XML file as Excel spreadsheet ANN Excel Programming 0 April 22nd 04 09:55 PM
Programatically adding worksheets to a spreadsheet Scott Lyon Excel Programming 4 August 8th 03 02:54 PM


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