

Sub Macro1()ĭocuments.Add Template:="Normal", NewTemplate:= False, DocumentType:=0Įnd Sub Add the code to Excel VBA and amend It may be slightly different, but not significantly. Your code should look like the following.

In this example: Normal -> Modules -> NewMacros. Click: Developer -> Visual Basic.įind the location of your recorded code in the Visual Basic Editor. We can now view the code for opening a new Word Document in the Visual Basic Editor. Stop the Macro from recording – Developer -> Stop Recording Open a new Word Document – File -> New -> Blank Document Click OK – the Macro Recorder is now running. Make a note of the “Store macro in” option, as we will need to know where to find the recorded code later. Firstly, lets create the macro to open a new word document.Ĭlick – Developer -> Record Macro. Using the Word Macro Recorder is again, similar to the Excel Macro recorder.įor the example in this post, we will create a macro which will open a new Word document, then copy a chart from Excel and paste it into that Word document. The key to the success of this method is taking small sections of code and building up a complex macro bit by bit. Then tick the Developer Ribbon option, OK. In Word: File -> Options -> Customize Ribbon If you have enabled the Excel Developer menu it is the same process in Word. The process I am about to show you may not create the most efficient code, but I know this process works, because I have used it myself to automate lots tasks using Microsoft Word. I am not an Excel VBA expert (I’m more of an Excel VBA tinkerer), and I am certainly not a Word VBA expert. Repeat the previous steps until macro complete.The process we will use for this is as follows: In this post, we will look at how we can control Word from Excel even though we don’t know any VBA code for Word.
#Microsoft word macro recorder how to
In the first part we looked at the basics of how to reference other applications using Early Binding or Late Binding. This post is the second in a series about controlling other applications from Excel using VBA.
