Macro

Home Search Site Map

Up
Add-Ins...
AutoCorrect Options...
Compare & Merge...
Customize...
Error Checking...
Formula Auditing
Goal Seek...
Macro
Online Collaboration
Options...
Protection
Research...
Scenarios...
Shared Workspace...
Share Workbook...
Speech
Spelling...
Track Changes

New! Excel User Group Now Open @ www.excelusergroup.org,

UK EXCEL USER CONFERENCE - LONDON, UK. APRIL 1st/2nd 2009 - TOTALLY FREE - DETAILS CAN BE CHECKED OUT HERE! Check It Out!


Menu command Type What happens next?
Macro Excel versions since 4 have been supplied with macros.  These are lines of instructions that allow Excel to perform repetitive tasks easily.

Since Excel V5 the preferred language for Excel macros has been VBA, (Visual Basic for Applications), an 'application specific' version of Visual Basic, (VB). This new language is object orientated and allows automation of virtually all actions available in the User Interface (UI) and many that are not, including automation with other programs who expose their object models to Excel.

Excel 4 type macros are still supported in all versions to 2003.

At their simplest, macros can be a recording of user actions, which can be re-run at will. It is normally not long however before users have a need to insert a variable, perhaps to collect a changing file name. This is where the power of VBA comes in.

The Macro menu, with it's sub-menus, below, is where all the recording and coding of macros/VBA goes on.

Macros...

This option presents the dialog below, which lists all the macros available in all open Workbooks, just the one that is active currently or any specific open book. (Unless the code is marked 'Private')

You can select macros from the list and then select 'Run' to run them, 'Edit...', to open the 'VBE' (Visual Basic Editor) and edit the code manually, 'Step Into' to debug any errors, 'Delete' them and also set up descriptions and shortcut keys for them via the 'Options...' button.

The dialog shows all 'standard module' macros (not event procedures). Those not in the currently active book are prefixed with there workbook name and ! (bang symbol). (remember code in open books only can be shown in this list). For an explanation of VBA implementation, module types, etc, click here.

Record New Macro...

Presents the dialog below allowing you to set up the recording of a new macro. You can name it, set a description, assign a shortcut key and determine where the macro should reside. (Read here for reasoning on this). You cannot record 'event code'.

Recorded code is often not the most efficient code as show here, but it works.

Once you start a recording, there is no need to rush, Excel is only recording the 'results' of your actions, not the time between, for example if I type in a cell the name 'Nick', one letter each hour, the recorder would record one line which would take nanoseconds to run when asked!

Starting a recording will display the 'Stop recording' toolbar, together with the button to record relative references rather than absolute one's in you macro.

If the toolbar fails to appear, it can be added in the normal way or you can return to the sub-menu, as this option will now be showing 'Stop Recording'.

Security...

Launches the security dialog, below. This allows you to set the default level of protection against attack from malicious code. Settings run from no protection/prompts. through prompting, to barring all with no prompting. Obviously if macros are disabled, no code can run. The second tab has a list of certificates that you have, through answering dialogs, mainly in Internet Explorer, decided to trust. Code signed with any of these certificates will ignore most security settings and will be loaded automatically. On the second tab, by default, you do not also get prompted from manually installed add-ins/templates, this can be switched off by un-checking the box.

Visual Basic Editor...

Launches the VBE, See here.

Visual Script Editor...

From Excel 2000 there was a rush to implement any internet feature they could, at this point MS included a link to it's preferred internet script language, Visual Script, to help integrate Office applications with the web.

Top

Copyright Nick Hodge 2008. All Rights Reserved.