How to use the macro examples
2002-11-14 Read me 0 181
You will have to set the macro security to Medium or Low (not recommended) to enable the application to run macros.
The macro security can be set from this menu: Tools, Macro, Security.
- Select and copy the code you are interested in from the web page
(click and drag to select, press Ctrl+C to copy). - Open a new workbook, or the workbook you want to use the code in.
- Press Alt+F11 to open the Visual Basic Editor (VBE).
- Select Insert, Module to insert a new code module into your workbook.
Some code examples are supposed to be pasted into special code modules (e.g. ThisWorkbook), this will be specified on the web page with the example. - Press Ctrl+V to paste the copied example code into the code module.
- Press Alt+F11 to go back to Excel.
- Press Alt+F8 to open the Macro dialog box.
- Double-click on the name of the macro you want to run.
Sub ExampleMacro(strName As String) MsgBox "Hello " & strName End SubThe macro above can be started from another macro like this:
Sub StartExampleMacro() ExampleMacro "John Doe" End Sub