?
Solved

Control type?

Posted on 2001-08-11
5
Medium Priority
?
210 Views
Last Modified: 2010-05-02
How can i at runtime deternimate what control type a object is?

for examble

For each object in me
msgbox object.type
next

ive tried alot og of things...using the typelib is one of them..but that dosnt work with calender controls....
0
Comment
Question by:BlaZer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 38

Expert Comment

by:PaulHews
ID: 6375872
This help?

Option Explicit

Private Sub Command1_Click()
    Dim ctl As Control
    For Each ctl In Controls
        Debug.Print TypeName(ctl)
    Next
   
End Sub
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 6375875
Or this?

Dim I   ' Declare variable.
   For I = 0 To Frm.Controls.Count - 1
      If Not TypeOf Frm.Controls(I) Is Menu Then
         Frm.Controls(I).Enabled = State
      End If
   Next I
0
 
LVL 1

Author Comment

by:BlaZer
ID: 6376470
number one comment works perfect..i dont know i could add a more question, but do u know how to deternimate the parent of the name? Like vb.commandbutton or MSComctlLib.TreeCtrl ?

if u cant/dont want to answer that ill just give u the points...
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 200 total points
ID: 6376479
I don't know how to determine that.  There may be some trick with type library code, but I have no experience with it.
0
 
LVL 1

Expert Comment

by:harsh008_k
ID: 6376871
'This should work fine
  Dim cntl As Control

  For Each cntl In Controls
     Debug.Print TypeName(cntl)
  Next
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question