Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2013, 02:52 PM
bshawnr bshawnr is offline Query list of objects and properties in VBA Windows XP Query list of objects and properties in VBA Office 2003
Novice
Query list of objects and properties in VBA
 
Join Date: Aug 2013
Posts: 2
bshawnr is on a distinguished road
Default Query list of objects and properties in VBA

I have several macros created with forms that have about 100 objects on the form. The objects are all named the default "checkbox1, optionbutton10", but are identified in the "Caption" field in properties. Can I get a list of the objects, and their captions for each form?

Thanks.
Reply With Quote
  #2  
Old 08-22-2013, 11:03 PM
fumei fumei is offline Query list of objects and properties in VBA Windows 7 64bit Query list of objects and properties in VBA Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

You do not state what you want to do with this list. Write to another document perhaps. In any case this may help you get started.
Code:
Sub ListCaptions()
Dim oCtl As MSForms.Control
For Each oCtl In UserForm1.Controls
   If TypeOf oCtl Is MSForms.CheckBox Or _
      TypeOf oCtl Is MSForms.Label Or _
      TypeOf oCtl Is MSForms.OptionButton Then
      MsgBox oCtl.Name & vbTab & oCtl.Caption
   End If
Next
End Sub
This gets the values for the controls that DO have Captions. For example textboxes, comboboxes do NOT have Captions. Thus they are not included in the test.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Add custom doc properties in "Doc properties control" eazysnatch Word 2 09-13-2017 08:08 PM
Query list of objects and properties in VBA Convert equation objects to inline objects sumjoh Word VBA 1 01-29-2013 08:38 PM
How to Query Text in MS-Excel 2010 or Import Data & Query outside of Excel? mag Excel 0 10-18-2012 11:15 AM
Query list of objects and properties in VBA Shape Objects Space Cowboy PowerPoint 4 10-04-2010 07:14 PM
NOprintable objects shadowbat Drawing and Graphics 0 07-05-2010 10:13 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:43 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft