Leading the way in Microsoft Office Development
 Home|Excel|Word|PowerPoint|Consultancy|Feedback|Contact 
 Microsoft Word > Macros > The Finishing Touches< Previous | Next > 

 

Adding Shortcut keys and Descriptions to your Macros

 
 

This does not have to be done when you record the macro and can easily be done afterwards.

 
 

You can add either a Shortcut Key or a Description to your macro by selecting (Tools > Macro > Macros) and selecting the "Options" button at the bottom.

 
 

If you add a description before recording a macro then this description will appear as a comment on the first few lines of the recorded VBA code.

 

 

Public vs Private

 
 

All procedures and Public by default.

 
 

To prevent a macro or procedure from appearing in the (Tools > Macro > Macros) dialog box you can change the scope from Public to Private.

 
 

It is always a good habit to explicitly state whether public or private to avoid any confusion.

 

 

Using the Status bar

 
 

If you switch the ScreenUpdating off to prevent the screen from flickering it is worth using the Status bar to keep the user informed about the current status of the macro.

 
 

If your macro takes a bit of time to complete using the status bar will ensure that the user does not think that the macro has crashed or is not responding.

 
 
1
2
3
4
5
6
7
8
9
10
' Make sure that the status bar is visible
Application.DisplayStatusbar = True

' Enter the message to be displayed
Application.Statusbar = "Please wait ….."

' **** Add Your Code Here ****

' When the macro has finished reset the status bar
Application.Statusbar = False
   
 

If you change the status bar to display a message to the user - make sure you reset it.

 

 

Running your Macros

 
 

An alternative to using a command button might be to run a macro by using a form field.

 

 Copyright © 2004-2007 Better Solutions Limited. All Rights Reserved.< Previous | Top | Next >