
Word copies the macro from the left Macros panel to the right Quick Access Toolbar panel. On that screen, locate your macro, select/highlight it, then click Add. Click Button and the Word Options/Customize Quick Access Toolbar screen opens. In the following example, the first table in the active document is converted to text and then formatted as a bulleted list. Use this Selection object to type the text into the WordDocument. Create a Selection object with the help of WordObject. Step 2: Add a macro button to the Quick Access ToolbarĪ. To maintain a reference to the converted contents of the table, you must assign the Range object returned by the ConvertToText method to a new object variable. For writing text in Microsoft Word Document using Microsoft Excel, you need to follow the steps below: Create the object of Microsoft Word. If the ReplaceSelection property is True, the selection is replaced by the specified text.If ReplaceSelection property is False, the specified text is inserted before the selection. Even though you can overwrite many of these shortcuts, it’s much easier to attach your macro to a button. Using the Selection object and the TypeText method Inserts the specified text.

Note: Most of the shortcut keys are already used by the system. Next, in the Assign Macro To panel, click Button or Keyboard (shortcut) for the method used to access and run the macro. For the Store Macro In field, choose All Documents to run this macro in all of your Word documents, or select the current document (displayed by filename) to use this macro in the current document only. This works fine on the sentence I record the macro on, however, the macro stores the number of words of that sentence only, and then I cannot readily apply it to shorter or longer sentences. Descriptions are just notes that summarize the macro’s function.Ĭ. One of the steps of the macro is to select the sentence and then convert text to table > Separate text at space.If you find yourself recreating the same table repeatedly in your Word documents, why not automate that job Using a macro, you can make the. Macro names cannot conflict with the program’s reserved commands or keywords such as Print, Save, Copy, Paste. You know how time-consuming repetitive tasks can be.Macro names can be 80 characters maximum.


You cannot use spaces, non-alphanumeric characters, or periods.
