Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How I can determine a base class of a procedure's incoming parameter?

1878026431
In VBA (Excel) I'm written procedure with an incoming parameter of type
Object. I need to determine which base class (not type) has this parameter.
How I can do it?

Public Sub FillControl(TargetControl As Object, SomeRS As ADODB.Recordset)
If [TargetControl is ComboBox] Then
TargetControl.AddItem "Item1"
...
ElseIf [TargetControl is Label] Then
TargetControl.Text = "Some text"
...
End If
End Sub

Thanks!

Dmitry V. Petkun


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default How I can determine a base class of a procedure's incoming parameter?

Check if TypeOf gives you what you want as in:

If TypeOf TargetControl is ComboBox then...

Strangely enough, it is documented only as part of the help on the
'If...Then...Else Statement'.

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
1878026431
In VBA (Excel) I'm written procedure with an incoming parameter of type
Object. I need to determine which base class (not type) has this parameter.
How I can do it?

Public Sub FillControl(TargetControl As Object, SomeRS As ADODB.Recordset)
If [TargetControl is ComboBox] Then
TargetControl.AddItem "Item1"
...
ElseIf [TargetControl is Label] Then
TargetControl.Text = "Some text"
...
End If
End Sub

Thanks!

Dmitry V. Petkun



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
Incoming file links sb1920alk Excel Discussion (Misc queries) 3 October 28th 08 10:47 PM
Incoming curve ball Limey Excel Discussion (Misc queries) 0 October 1st 07 06:36 PM
incoming mail excel angie Excel Discussion (Misc queries) 1 May 2nd 07 07:45 AM
How to choose if I use a parameter or not in a parameter query Arnaud Excel Discussion (Misc queries) 0 March 8th 07 01:19 PM
Live incoming data peter z Charts and Charting in Excel 1 September 25th 05 04:59 PM


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