How to use the macro examples

 2002-11-14    Read me    0    56

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

  1. Select and copy the code you are interested in from the web page
    (click and drag to select, press Ctrl+C to copy).
  2. Open a new workbook, or the workbook you want to use the code in.
  3. Press Alt+F11 to open the Visual Basic Editor (VBE).
  4. 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.
  5. Press Ctrl+V to paste the copied example code into the code module.
  6. Press Alt+F11 to go back to Excel.
  7. Press Alt+F8 to open the Macro dialog box.
  8. Double-click on the name of the macro you want to run.
If the name of the macro you want to run is not visible in the Macro dialog box, this can be caused by the fact that the macro need input to start, e.g.:

Sub ExampleMacro(strName As String)
    MsgBox "Hello " & strName
End Sub
The macro above can be started from another macro like this:

Sub StartExampleMacro()
    ExampleMacro "John Doe"
End Sub


Leave a comment:

Your comment will only be published after it has been moderated and found spam free.
Your e-mail address will only be used to display your Gravatar.