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.
"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
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.
Now you have your generated code and can see how Word does it.
Last edited by RobDog888; May 13th, 2006 at 02:04 PM.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
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.
Last edited by koolsid; Feb 18th, 2010 at 09:58 AM.
Reason: Added more text
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ MyGear:
Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011