geniusright.blogg.se

Using macro recorder word
Using macro recorder word













using macro recorder word

All written macros will appear in the Macros dialog box (as will all recorded macros).

using macro recorder word

We should also comment on what appears and does not appear in the Macro list box. Most useful Word programs are far too complicated to be recorded automatically by the macro recorder. Second (and more serious), the macro recorder is capable of recording only very simple procedures. For instance, the previous search and replace can also be done using the following code, which is considerably more compact: Sub AMacro()

using macro recorder word

First (and least serious), since the macro recorder does such a thorough job of translating our actions into code, it tends to produce very bloated code, which can run very slowly. However, before you get too excited about this cut-and-paste approach to programming, we should point out that it is not anywhere near the panacea one might hope.

Using macro recorder word how to#

If we can’t figure out how to code a certain action, we can record it in a macro and cut and paste the resulting code into our own program. In certain situations, the macro recorder can serve as a useful learning tool. Word does a very thorough job of translating keystrokes into VBA code, essentially matching in code every item in the Find and Replace dialog box shown in Figure 4-14-even the ones that we have not changed-because it has no way of knowing what we have and have not changed!įigure 4-14. The Find and Replace dialog box This is the same code that someone might have written in order to perform this find and replace operation. When we ask Word to record a macro, it takes note of our keystrokes and converts them into a VBA subroutine (with no parameters).įor example, suppose you record a macro that does a find and replace, replacing the word “macro” with the word “subroutine.” When you look in the Projects window under the project in which the macro was recorded (usually the attached template), you will find a new standard module called NewMacros containing the following subroutine: Sub AMacro() Word has the capability of recording very simple macros.















Using macro recorder word