Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
J J is offline
external usenet poster
 
Posts: 1
Default How to check if an object has a certain property?

If I have a procedure that takes as input an object, how do I
programmatically check to see if that object has a height property?

Function CheckForHeightProperty(InputObject as Object)

?? How do I check to see what properties this object has? Is there any way
to enmurate them programmatically??

End Function


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default How to check if an object has a certain property?

Hi

I'd do it the brutal way; ask for it and check for errors:

Function HasHeight(InputObject As Object) As Boolean
Dim D As Double
On Error Resume Next
D = InputObject.Height
If Err.Number = 0 Then HasHeight = True
End Function

Sub test()
MsgBox HasHeight(ActiveSheet.Rows(4))
MsgBox HasHeight(UserForm1)
MsgBox HasHeight(Application.AnswerWizard)
End Sub

HTH. Best wishes Harald


"J" skrev i melding ...
If I have a procedure that takes as input an object, how do I
programmatically check to see if that object has a height property?

Function CheckForHeightProperty(InputObject as Object)

?? How do I check to see what properties this object has? Is there any way
to enmurate them programmatically??

End Function




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
Object property/method problem Ayo Excel Discussion (Misc queries) 6 August 30th 07 10:18 PM
Lookin property of the FileSearch object [email protected] New Users to Excel 0 December 5th 06 09:37 PM
Page Object property Matt[_18_] Excel Programming 1 October 2nd 03 01:43 PM
Object not supporting property or method Stuart[_5_] Excel Programming 3 August 23rd 03 07:45 AM


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