Open DOC File

Information, tips and instructions

Form Controls and Macros in a DOC file

This type of extension is mainly related to Microsoft Word, it was created and published by the Microsoft Corporation in its versions of Word between 1997 and 2003.

Unlike DOCX files, DOC files are a type of binary file that is basically composed of frames and records that focus on texts, that is, this type of extension is responsible for storing all formatting information, graphics, texts, scripts, images, tables, undo information, among others, in binary form.

Although it is an obsolete format, files with a DOC extension can be used taking advantage of the most recent features of office automation packages, such as insertion of form controls, and also the recording / editing of macros.

In this article we will discuss how to insert controls and macros through LibreOffice Writer, in a DOC file.

First of all, you must be sure that you have the most recent version of JRE installed on your device.

Steps to Record / Edit Macros

The modules edited in LibreOffice Writer macros are based on the Basic language, similar to Microsoft's VBA.

  • Step 1: Activate Macro recording in Tools> Options> LibreOffice> Advanced> Optional Features. You must activate 'Enable macro recording'.

  • Step 2: If you are going to record a macro you must activate Tools> Macros> Record Macro and going on, do all the actions that the macro will contain, be it executing a module, formatting a table, etc.
  • Step 3: When finished, you must click on 'Finish Recording'

To edit a macro

  • Step 1: Click on Tools> Macros> Edit Macros and write the code you want to write.

  • Step 2: Save all changes and edits, if you want you can identify the macro with the name you want.
  • Step 3: To run it, you can insert a button in your document and assign the macro you edited earlier as an action. In Form> Push Button and put it in the place you want in your document.

  • Step 4: Double click on the button to verify its properties and in the 'Mouse Button Pressed' field of the 'Events' tab you can find the macro you edited earlier and assign it to that action.

  • Step 5: Save all changes, and be sure to uncheck the 'Edit Mode' box in Form.

You can see that the button executes the action you edited in your macro.