View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
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