Example: Copy the text string from a MText object to a Microsoft Word document (AutoLISP/ActiveX)

The following example creates an AutoLISP application that works with Microsoft Word 2016 and an AutoCAD drawing that contains MText.

Note: ActiveX support in AutoLISP is limited to Windows only and AutoCAD LT does not support the use of third-party type libraries.

Create a new AutoLISP program and load the ActiveX support functions

  1. Create a new LSP file and save it with the name copyMText2Word.
  2. In the new file, enter (vl-load-com).

Obtain the AutoCAD application and current ModelSpace objects and store their pointers

Import the Microsoft Word type library

Change the :tlb-filename argument in the following code to point to the msword.olb file on your system.

Establish a connection to a Microsoft Word application

Process the MText objects in model space

Load and run the code

  1. Save the LSP file and then load it into AutoCAD.
  2. At the AutoCAD Command prompt, enter copymtext2word.