

#MS WORD 2016 MACROS CODE#
Consider the following code snippet, which saves a document in Word format:ĪctiveDocument.SaveAs FileName:=sDocName, _ The steps to actually save the file are relatively easy. Anthony would like to have the macro save the file using the same root name as the original text file, only changing it to Word format, as in filename.docx. He is wondering what commands he should add to his macro to automate the last step of saving the data. After the formatting macro is complete, Anthony manually uses "Save As" for each report to save it as a Word document. He then uses macros to format this imported information. Just imagine, you press one combination of keys and see a pretty text instead of a mess of a document.Anthony regularly imports multiple reports, in text files (i.e, filename.txt), into Word. You can create lots of commands for different types or parts of the documents you work with. Such solutions as macros for formatting are only the tip of the iceberg. In both cases, don't forget to press Stop recording as soon as you finish applying the changes to save all the settings. Those will be a sample for the future formatting pattern. If you need a separate macro for customizing specific parts of a document, instead of pressing Ctrl+A in the beginning, just select a word or two you need to change and apply the needed edits to them. open the Paragraph dialog box on the Home tab, set the line-spacing and other details you need to take care of in every or most of the documents.Ģ.If all you need is to format all the text you have, as soon as the recording icon is shown on the screen, press Ctrl+A and then start applying (using your mouse) the settings for the final formatting you need: You may want to format the whole document or separate pieces.ġ. In this case, it also runs down to two ways depending on what you need. Test the command on your sample using the shortcut you came up with. If the code you have already contains the 'Sub', prime symbols, the macro name (the word(s) in green), and 'End Sub', delete them therefrom and insert the code into the window you have just as instructed above.Ĭlose the main window with all the unclear stuff you see for the first time. However horrifying the new window may look to you, keep calm.Īll you need to know is that the code you have should be inserted as a separate passage after the last prime symbol (') and before 'End Sub'. Choose the command with the name you just created and press Edit. If you already have a macro in a text format, just go the same way as previously ( View → Macros) and choose Stop recording. If you have to record a custom macro yourself, don't be afraid. If it's about some universal stuff, you're probably not the first one who tried to search for an automated solution. You may already have a macro you need to integrate into MS Word ready.

As soon as it does, press Assign, and the pointer of the mouse will show you a recording icon. Current keys field located to the left - the combination entered by you should appear there.So, choose the keys standing close together. Take into account that it should be easy for you to press that combination later. Press the first key(s) and a letter on the keyboard.

Usually, they start with Ctrl/ Alt/ Shift (or several of them). Press new shortcut key line - come up with a combination of keys.It may seem overloaded and complex, yet, all you need at this stage are: Then, in the same window, choose keyboard and press ok. Write down the name of your command in the respective field and make sure All documents is chosen under the Store macro in line. After that, choose Macros → Record Macro. The first thing you need to look for is the View tab. Switch the font style of a couple of paragraphs.Make the font size of several sentences bigger.Search for any article (you can use even this one), copy it to MS Word, and create a mess. you work with long Word documents that can't be formatted manually in a tick.you are a student whose professor is picky about the format.

