We can find the case that we already have macros in VBA, but we need to import them into Word. This happens, for example, when we have created our macros on another device or have been sent to us by someone else . Furthermore, on the Internet, there are several web pages where it is possible to find numerous macros and code. Microsoft Word gives us the option to import those command strings already created so that we can, in this way, use them in Word. For this, the necessary tool is the Visual Basic editor that we have already mentioned previously. To open it, we can use the keyboard shortcut [ Alt] + [F11] or go to the "Developer" tab.
The steps that we must take next will be different depending on whether we are importing a file with macros or macro code.
Import files with ready-to-use macros ( .frm , .bas , .cls ):
If you have a file with macros, you can import it into your Word program in a few steps. The first is to search in the Visual Basic Project Explorer for the document to which we want to add our imported macro. If the Project Explorer is not visible in the code editor, you have to go to the? View? and click? Project Explorer ?. Then click on your current project or on another Word project if you want it to apply to a specific document. If we select the? Normal? Project, the Word macro will be imported into all documents: