[FAQ's: OD] How do I record a macro?
To record a macro (in most Office apps) you need to start the recording by going to "Tools > Macro > Record New Macro...". You will then be prompted with a dialog window to fill in and make some choices Fig. 1. Word 2003 was used in this example. Currently, only Word and Excel support the actual recording of a macro, but other Office apps do support Macro manually written code in the VBA editor. A Macro is nothing more then a VBA procedure of code.
Fig. 1
http://www.vbforums.com/attachment.p...chmentid=47488
For ex.
"Name:" the name of the macro or procedure name.
"Assign:" you can sssign the macro to be invoked from a keyboard keypress or a toolbar button click or just leave it unassigned (default). Usually if your recording a macro to identify the necessary code for doing something that you dont know hoiw to is best to leave it unassigned.
"Store macro in:" This depends on how your going to be using the macro. If you want it to be available in all documents then you will want to store it in your Normal.dot template. If you want it to only be available in a document then store it in that document by choosing it from the dropdown combo.
"Description:" This is where you can enter in comments for your macro/code procedure. They will appear in the beginning of the code as actuall comments.
Now click the Ok button and your now Recording your every action, in most cases, and you should see a toolbar appear with the Pause and Stop recording buttons as seen in Fig. 2. If you dont you can still Stop the recording from the "Tools > Macro > Stop Recording" menu item. Do the task that you want to automate and then press the stop button. For this example its typing in "Hello World!", Fig. 3
Fig. 2
http://www.vbforums.com/attachment.p...chmentid=47489
Fig. 3
http://www.vbforums.com/attachment.p...chmentid=47490
You can view the generated code by going into the VBA IDE (press Alt+F11) and in the Modules folder you will see NewMacros module. Select the Module and scroll down to your procedure that you named it in Fig. 1 Name field. Depending on the location that you choose to store the macro in it will either be under the Normal project/Modules NewMacros or DocumentName/Modules NewMacros, see Fig. 4.
Fig. 4
http://www.vbforums.com/attachment.p...chmentid=47491
Now you have your generated code and can see how Word does it. :)
1 Attachment(s)
Re: [FAQ's: OD] How do I record a macro?
Recording Macros in Office 2010
Click the View menu and choose the Macros ¬¬> Record Macro. See picture attached. This applies to MS Excel, MS PowerPoint, MS Word and other Apps in 2010 as well. Rest remains almost the same as shown above by Rob in post 1.