Continue to Site

Welcome to 3DCADForums

Join our CAD community forums where over 25,000 users interact to solve day to day problems and share ideas. We encourage you to visit, invite you to participate and look forward to your input and opinions. Acrobat 3D, AutoCAD, Catia, Inventor, IronCAD, Creo, Pro/ENGINEER, Solid Edge, SolidWorks, and others.

VBA obj.Properties(strPropertyName)

nickvans

New member
Hi all,

You guys are great, and your forum is one of the most helpful things on the internet. I'm hoping you might be able to help me figure out why something I'm doing isn't working.

I'm trying to create a function that will compare a string value to the value of an arbitrary (specified) property of an object. Elsewhere online I've found several functions like this:

Code:
Public Function HasProperty(obj As Object, strPropName As String) As Boolean
    'Purpose: Return true if the object has the property.
    Dim varDummy As Variant

    'On Error Resume Next
    varDummy = obj.Properties(strPropName)
    HasProperty = (Err.Number = 0)
End Function

Which is apparently supposed to find the property specified by strPropName within the object. However, when I run this, I always get "Error 438: Object doesn't support this property or method." It seems to be complaining about the .Properties method, but I don't know why.

Can anyone give me some advice as to why .Properties doesn't work? Otherwise, is there any other way to access an property by name without hardcoding in the property?

(Note: I'm trying to avoid statements like obj.Name, obj.Path etc)

Your help is much appreciated!
 
Object Properties

Hi there,
The term "Properties" is used in the Catia User Interface as general method access to see what is available for user viewing.

In any OO code like the CATIA software, each different object has methods (to do something) and properties (that show same characteristics of it). But they are all just about created specifically (like LeafProduct) or inherited (like Name)

You have to check in the Catia Documentation or check your

C:\Program Files\Dassault Systemes\"your installation here"\intel_a\code\bin\V5Automation.chm

file, for specific ways to interrogate and use the objects. Good luck.
Raul
 

Articles From 3DCAD World

Sponsor

Back
Top