A macro is a piece of executable Visual Basic for Applications code, or VBA, in Microsoft Word. A macro helps you customise Word to fit your needs and replace repetitive tasks. For example, if you constantly find yourself converting Word documents to PDFs, a macro button can replace several keystrokes with a single macro function. You write the code once and use it whenever you want to turn a Word document into a PDF. VBA is built into Word 2007 and Word 2010.
Press "Alt" and "F11" in Word. This opens the Visual Basic Editor, or VBE, where you enter the VBA code.
Click on "Insert" and then click on "Module" to open a new window.
Cut and paste the following code into the window:
' WordtoPDF Macro
Modify the output file in the code to show where you would like the PDF to end up. In the above example, the file is sent to the Desktop.
Press "F5" to run the program.
Press "alt" and "F11" to toggle between the VBE and the regular Word window. To run the code without entering the VBE, click on the "Developer" tab and then click on "Macros." Click on the macro name---(the macro name of this subroutine is WordtoPDF---and then click on "Run."