Reveal Codes In Word 2016 For Mac
The Ribbon in Word 2016 hasn’t changed much from Word 2013. (Click image to enlarge it.) To find out which commands live on which tabs on the Ribbon, download our Word 2016 and 2019 Ribbon quick. Word 2016’s paragraph-level formatting commands affect paragraphs in a document. That makes complete sense, but what is a paragraph? Officially, a paragraph is any chunk of text that ends when you press the Enter key. So a single character, a word, a sentence, or a document full of sentences is a paragraph, so long as you press the Enter key. Instructions in this article apply to Word for Microsoft 365, Word 2019, Word 2016, Word 2013, Word 2010, and Word 2007. The Problem With Using Source Code in Word Programmers write software programs using languages such as Java, C, and HTML.
- It shows the code that Word inserts for the properties and options selected so far (see Figure 16.2). Figure 16.2 View the codes behind the properties and options you have selected. To delve even further into the field’s coding, click the Options button to display the Field Options dialog box.
- To turn on/off reveal codes: Open a WordPerfect document. Press Alt + F3 or click View Select 'Reveal Codes.' The codes will appear at the bottom of your document.
Applicability: Word 365, 2019, 2016; Windows and MAC OS X operating systems.
Here’s a question from a reader::
I am a teacher typically use Word 2019 to write my documents. I often need to change the font and size of my document paragraphs. Is there a way to automate my work with Macros, so i can modify my document paragraph with a one click? I am sure this is going to save me a couple of hours per week, which i’ll gladly invest in other tasks.
Thanks for your question. The key advantage of Macros is that they allow you automate your tasks in Microsoft Office applications. Macros can be either recorded or manually coded using Visual Basic for Applications (VBA). Word ships a Macro recorder that allows you to develop automation scripts without coding. If you are just starting out with automation, this might be a good enough solution. That said, with a little bit of VBA knowledge, you can write efficient and powerful Macros.
Enabling the developer tab in Word
If you don’t see the Developer tab in your Microsoft Word Ribbon, you’ll need to setup your Macro development environment.
- Open a new Word document. In case that you would like to work on an existing file, ensure that you have a copy for backup, before making any changes.
- Now, go ahead and make the developer menu visible in the Ribbon.
Recording a Word Macro – a practical example
- Now, hit the newly added Developer tab.
- Go to the Code button group.
Word 2016 For Mac Free
- Hit the Record Macro button to invoke the Macro recorder function.
- Define a meaningful name for your Macro. Note:As the name you provide will be used in the auto created VBA code, Ensure no spaces in the Macro name.
- Note:Although it’s possible to assign Macros to buttons , for simplicity we’ll runMacro manually via the View tab or Developer tabs.
- Execute the sequence of steps you would like to record. In this case, you’ll record the following steps:
- Select a specific paragraph in your document.
- Go to the Home tab.
- Set the font to Times New Roman.
- Set the Font Size to 16.
- Center your Text by hitting Ctrl +E.
- Once Done, return to the Developer tab and hit Stop Recording.
- Now let us take a look at the auto-generated VBA code. Hit Macros and then highlight the AutoFormat Macro and hit Edit.
- Close the VBA Editor.
Save your work in a Word Macro enabled template
- Hit File, then Save As.
- In the Save As dialog right hand side, determine your saving location and provide a meaningful name to your Workbook.
- Choose Word Macro Enabled Document as your document type. Note: Your Word document will be saved with the .docm suffix.
- Hit the Save Button.
Reveal Codes In Word 2016 For Macbook Pro
Executing your macro
- Open your Word document.
- Select the Paragraph you would like to automatically format. Just as an example, here’s the paragraph i chose:
- Go to the View tab.
- Hit the Macros button.
- Select your AutoFormat Macro
- Hit Run – this will apply the macro on the selected paragraph.
- Voi’la , nice result!
Assigning your Macro to Buttons or keyboard shortcuts
Note: This is an optional step that should be attempted after you have followed the Macro recording tutorial above.
OK, so far we got our Macro basics working. Now it’s time to improve a bit our Macro usability in the Word doc. Let me show you how you can associate your Macro with a quick access button, so you can launch it more easily.
- Right click on the Ribbon and select Customize the Quick Access Toolbar.
- The Word Options dialog will come up.
- In the Choose commands from dropdown, select Macros.
- Highlight your Macro and hit the Add>> Button to add a shortcut to your Macro to the Quick Access Toolbar.
- Hit the Modify… button to define a suitable icon for your Macro.
- Define a Display name for your button.
- Hit OK.
- Now, you can launch your Macro from the Quick Access Toolbar, just above the Ribbon.
Note: You are able to associate your Word Macro not only with quick access buttons but also with command buttons embedded in your document and specific custom keyboard shortcuts.
Creating Word Macros using VBA
With some simple Visual Basic for Applications coding skills we can edit the macros and write programs to automate various kinds of works using VBA. Windows recovery toolbox.
Aside Note: FYI – some of the Microsoft Office applications, such as Powerpoint and Outlook, do not have built in macro recorders. Therefore, writing VBA is mandatory for writing Powerpoint macros and automating Outlook.
- To edit a macro, click on the Developer tab and select Macros in the code option.
- Click on the macro and select Edit.
- The Visual Basic for applications editor will open up.
- Let’s assume that we want to manually edit the Macro we have recorded in the previous step, so that Word not only set the Size, font and alignment of the paragraph, but also the color.
- Setting the color of a section is achieved using the following VBA command:
[code] Selection.Font.Color [/code]
- In our case, we’ll want to set it to a random blue, so we’ll append the following snippet to our Recorded macro:
[code] Selection.Font.Color = 16737792[/code]
- Here’s how your VBA code should look like:
- In the VBA Editor hit File and then Save.
- Back to your document, run your Macro on a paragraph and observe the font color change.
- Voi’la!
Useful Word Macro example you can write
Since publishing this tutorial, many readers asked for more in depth examples of Word Macros. This list covers the most prevalent tasks you can automate using Visual Basic in Word. Here we go:
Create and Save New Document
Note: When creating new documents, you are able to specify the template (.dotm/.dotx files) you would like to use. Templates are typically stored at: C:Users<your_user_name>AppDataRoamingMicrosoftTemplates
Reveal Codes In Word 2016 For Mac Os
Open a Word document with VBA
Closing one/all open documents
Saving Word as PDF
Here’s how to easily automate saving of Word documents as PDF files.
Inserting header and footer
This code sets the header and footer of your Word document first page.
Additional Word Macro ideas
Here are a few more ideas which we’ll be posting in the upcoming future.
- Find and Replace (Execute Method)
- Insert a paragraph (before and after a selection)
- Printing documents programatically
- Working with tables
This concludes our tutorial for today. As you just saw, there is a lot to be done with the Word macro recorder and VBA Macros in Word. In case you are looking for more specific help that goes beyond the scope of this tutorial, kindly contact us via our contact form.