[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Tip 2262: Pass Strings Btw VBA/LISP Using Dictnry
Tip# 2262 By Bill Kramer On 01-Dec-2007
Rated By 1 users Downloaded : 786
Categories : Misc. User Tools, LISP Code Modules, VBA Code Modules
Software type : AutoCAD
Rename File To : Tip 2262: LISPVBA.LSP
LISPVBA.LSP: This is one option to bridge the communications gap between the Visual LISP and VBA environments, using a dictionary with an Xrecord.

Tip 2262: Pass Strings between VBA and Visual LISP Using a Dictionary
When VBA first appeared on the scene, I thought it would be great if we could use VBA's superior user interface capabilities in dialog boxes along with the more AutoCAD-intimate Visual LISP. Like other users, I quickly discovered that there was a communications gap between the two. This tip represents one way to bridge the communications gap between the two environments: using a dictionary with an Xrecord. Xrecords are nongraphic objects in a drawing that can contain data arranged in group codes. Unlike extended data in which all the group codes are in the thousands, the Xrecord group codes are just like normal entities. It's a convenient place to save and pass data between modules such as strings, numbers, points, and entity links. The function example in this tip works with just a single string, but you could expand it to meet your own needs. A dictionary named LISP_VBA (source file LISPVBA.LSP) is created and used by both Visual LISP and VBA to share data in a single Xrecord containing a string data element. To make it easier in Visual LISP, the functions (LISP->VBA) and (VBA->LISP) are provided. (LISP->VBA) has one parameter, which is a string. (VBA->LISP) has no parameters, but it returns a string. An example module (BAS file) for VBA can catch and receive data provided as part of the next tip, Use VBA for Input from Visual LISP.



Average Rating:

User comments