What commands are helpful when debugging macros?

  1. Go to Minitab Session Command Help.
  2. Under Macros Session Commands, click Debugging Tools.

"Invalid path * NOTE * Command canceled"

This message appears when you try to run a macro that uses the GSAVE subcommand to save a graph to a nonexistent path. Correct the path specified in the GSAVE subcommand, then save the macro again. The macro should run.

"File not found"

This message appears for one of the following reasons:
  • The macro is not in the Macros folder that is defined in Minitab.
  • The macro is not a text file with the .MAC file name extension.

Reason 1: The macro is not in the Macros folder that is defined in Minitab.

To resolve this issue, you can use can use one of the following options:
  • Put the macro in the Macros folder.
    • If you don't know where the Macros folder is, in Minitab, choose File > Options > General. The Macros location field specifies the path to the Macros folder. You can either save your macros to the specified folder, or you can enter the path to the folder where your macro is currently saved.
  • Specify the Macros folder in the Command Line pane.
    • In the Command Line pane, enter the path to the macro. For example, if the name is MyMacro and it is saved in C:\Macros, enter:
      %'C:\Macros\MyMacro'

Reason 2: The macro is not a text file with the .MAC file name extension.

If the macro is saved in the correct folder, and you get the same message when you try to run the macro, then do the following:

  1. Open the macro in a text editor, such as Microsoft Notepad.
  2. Choose File > Save As.
  3. In File name, enter the name of the macro with the .MAC file name extension, for example, MyMacro.mac.
  4. From the Save as type list, choose All Files (*.*).
  5. Click Save.

"Invalid file name"

This message appears when you try to run a macro (either a Minitab macro or one that you wrote. Verify that the application that you used to write or modify the macro in is not open. For example, if you wrote or modified the macro in Microsoft Word, and Microsoft Word is still active, then close it.

"In a local macro, the WORKSHEET command can be used only to rename a worksheet"

This message appears when you try to use the WORKSHEET command in a local macro to make a certain worksheet active. As a work-around, you can use an Exec file to call up each worksheet and then the macro in turn. Suppose, for example, you want to run a local macro called MyLocal on two worksheets named "Week1" and "Week2". Here is an example of what the Exec file might look like:

Worksheet "Week1"
%MyLocal
Worksheet "Week2"
%MyLocal

"Expecting a macro header. Found instead: ÐÏ à¡±" or "No macro program in the file"

These messages appears when you try to run a local or global macro that was written in Microsoft Word and the macro is not saved in Text only (*.txt) format. You can use one of the following options to save the macro written in Microsoft Word in Text only (*.txt) format:

Option 1

  1. Open the macro in Microsoft Word.
  2. Choose File > Save As.
  3. In File name, enter the name of the macro including the .MAC file name extension, for example, MyMacro.mac.
  4. From the Save as type list, choose Text Only (*.txt).
  5. Click Save.
    Note

    If you get a message that says the file "may contain features that are not compatible with Text Only format. Do you want to save the document in this format?", click Yes.

  6. Close Microsoft Word.

Option 2

  1. Copy and paste the contents of the macro from Microsoft Word into Notepad.
  2. Choose File > Save As.
  3. In File name, enter the name of the macro including the .MAC file name extension, for example, MyMacro.mac.
  4. Click Save.

"Argument is a constant or matrix, but a column was expected" or "Macro exiting"

These messages appear when you try to run a macro from the Minitab Macros Library and the macro prompts you for input while session commands are disabled. To enable session commands choose View > Command Line/History.

If the macro does not prompt you for input and you are getting this message, verify that the macro is being called using the correct commands and subcommands.