About Setting and Returning System Variables (VBA/ActiveX)

The Document object provides the SetVariable and GetVariable methods for setting and retrieving AutoCAD system variables.

For example, to assign an integer to the AutoCAD MAXSORT system variable, use the following code:

ThisDrawing.SetVariable "MAXSORT", 100