You can access an object’s properties using the wrapper functions that are created by importing a type library or directly with the use of the vlax-get-property and vlax-put-property functions.
After loading the ActiveX support functions with vl-load-com, you can use the vla-get- and vla-put- functions to get and set the values of an object’s property.
The vla-get-propertyname function returns the property of an object, while vla-put-propertyname function assigns a value to an object’s property. These functions require the following arguments:
For example, the following returns the AutoCAD application object's ActiveDocument property:
(vla-get-ActiveDocument (vlax-get-acad-object)) #<VLA-OBJECT IAcadDocument 00302a18>
The functions that start with vla- are wrapper functions for the AutoCAD type library, but the names of the wrapper functions for other type libraries will vary based on the prefixes you use. Importing a type library is ideal so you can see which functions are available to you using the Apropos window. However, not all properties, method, and constants in an imported type library are wrapped.
For example, there is no wrapper function available to obtain the CommandBars property of the Microsoft Word application object, but the following statement achieves this:
(setq ComBars (vlax-get-property msw 'CommandBars)) #<VLA-OBJECT CommandBars 0016763c>
The vlax-get-property function returns the property of an object, while the vlax-put-property function assigns a value to an object’s property. The functions require the following arguments:
You can use vlax-get-property (and vlax-put-property) even if a wrapper function is available.
For example, the following returns the AutoCAD application object's ActiveDocument property:
(vlax-get-property (vlax-get-acad-object) 'ActiveDocument) #<VLA-OBJECT IAcadDocument 00302a18>