Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can I select all Controls in a wooksheets

If I puts the textboxes, comboboxes,... on a sheet. Is there any way i
Execel VBA to loop through these components?
Please help me if you know. Thanks a lot

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How can I select all Controls in a wooksheets

Hi Bookworm

For Each myshape In ActiveSheet.Shapes
' Your code
Next myshape


You can use this if you want to run your code only for pictures or something else

If myshape.Type = msoOLEControlObject Then .....
If myshape.Type = msoFormControl Then ......
If myshape.Type = msoPicture Then .....
If myshape.Type = msoAutoShape Or myshape.Type = msoLine Then .....
If myshape.Type = msoTextBox Then .....

There are more options


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"bookworm98 " wrote in message ...
If I puts the textboxes, comboboxes,... on a sheet. Is there any way in
Execel VBA to loop through these components?
Please help me if you know. Thanks a lot!


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How can I select all Controls in a wooksheets

If they are from the control toolbox toolbar

Dim oleObj as OleObject
for each oleObj in activesheet.OleObjects
if typeof oleObj.Object is MSForms.Textboxt then

elseif typeof oleObj.Object is MSForms.Combobox then

end if
Next

--
Regards,
Tom Ogilvy

Ron de Bruin wrote in message
...
Hi Bookworm

For Each myshape In ActiveSheet.Shapes
' Your code
Next myshape


You can use this if you want to run your code only for pictures or

something else

If myshape.Type = msoOLEControlObject Then .....
If myshape.Type = msoFormControl Then ......
If myshape.Type = msoPicture Then .....
If myshape.Type = msoAutoShape Or myshape.Type = msoLine Then

......
If myshape.Type = msoTextBox Then .....

There are more options


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"bookworm98 " wrote in message

...
If I puts the textboxes, comboboxes,... on a sheet. Is there any way in
Execel VBA to loop through these components?
Please help me if you know. Thanks a lot!


---
Message posted from http://www.ExcelForum.com/





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How can I select all Controls in a wooksheets

Thank you Tom. It works!
Okie. Can you know the way to set a ListBox(Form) empty.
With the TextBox and Combox the Text property can read and write.
But with the ListBox i think it only can read?
Is there any way

--
Message posted from http://www.ExcelForum.com

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
Cannot select multiple controls Blue Max New Users to Excel 3 March 14th 10 07:28 AM
How do I delete multiple of wooksheets jd Excel Worksheet Functions 1 February 24th 09 06:17 PM
linking wooksheets abourg8646 via OfficeKB.com Excel Discussion (Misc queries) 0 April 15th 06 06:36 PM
Using COUNTIF in multiple wooksheets Savage Excel Discussion (Misc queries) 3 December 18th 05 08:20 PM
Select All controls in a worksheet and delete them rova78 Excel Discussion (Misc queries) 1 April 28th 05 11:05 PM


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