What commands are helpful when debugging and error handling macros?

  1. Choose Help > Help, then click Session Commands.
  2. Under Command Listings, click Macro Commands by Function.
  3. Scroll down to Debugging Tools and Handling Errors.

When I try to run an exec an error occurs and it stops running. How can I make the exec continue to run after the command that triggers the error?

You can use the undocumented ZERROR command in the exec.

For example, suppose the exec contains the following commands:

RAND 10 C1
DESS C1
RAND 10 C2
DESC C2

If you try to run this exec you will get the following error message in the Session window and the exec will stop running:

* ERROR * Unknown Minitab command: DESS

If you add the ZERROR command to the exec as shown below, you will still get the error message in the Session window, but the exec will continue to run.

RAND 10 C1
DESS C1
ZERROR
RAND 10 C2
DESC C2

Why do I get the message "* ERROR * Invalid path * NOTE * Command canceled" when I try to run a macro?

This error 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 resave the macro. The macro should run.

When I try to run a macro I get the message, "* ERROR * File not found:"

Here are two possible explanations.

Problem 1 - Minitab cannot find the macro.

You have several options to fix this problem.

  • Put the macro in the Macros folder. For example, C:\Program Files\Minitab\Minitab 16\English\Macros.
  • Choose Tools > Options. In Macro location, type the desired folder, or click the Browse button to navigate to the desired folder.
  • Type the path when you invoke the macro. For example, if the name of the macro is MYMACRO and it is saved in C:\MACROS, type:
    %'C:\MACROS\MYMACRO'
    .

Problem 2 - The macro is not saved as a text file with the appropriate .MAC file extension.

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

  1. Open the macro file in Notepad.
  2. Choose File > Save As.
  3. For File name, enter the name of the macro with the .MAC extension, all in double quotes (for example, "MYMACRO.MAC").

    Or, for File name, put the name of the macro with the .MAC extension (for example, MYMACRO.MAC), and for Save as type, select All Files.

  4. Click Save.

Resolve the "* ERROR * File not found:" message

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 macro (.mac) file extension.
Tip

If the macro is in the Macros folder and has the .mac file extension, to quickly run the macro without getting the message, in the Command Line Editor, include the file path with the file name, as follows:

%'C:\Users\sgarcia\Documents\minitab_documents\MyMacro'

  1. Put the macro in the Macros folder.
    • If you don't know where the Macros folder is, in Minitab, choose Tools > Options. The Macros location field contains the folder path.
    • If the Macros location field is empty, enter a path (for example, C:\Program Files\Minitab\Minitab 17\English\Macros).
  2. Run the macro.
  3. If the message appears again, do the following to save the macro as a text file with the .mac extension:
    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 extension (for example, ProjectMacro.mac).
    4. From the Save as type list, choose All Files (*.*).

Now you can run the macro and the message will not appear.

When I try to run a macro (either a Minitab macro or one I wrote or modified), I get the message, "* ERROR * Invalid file name."

Make sure 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 open, close Microsoft Word.

I want to use the WORKSHEET command in a local macro to make a certain worksheet active but it says: * ERROR * In a local macro, the WORKSHEET command can be used only to rename a worksheet

As a work-around, you can use an Exec 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 could look like:

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

Why do I get the message "** ERROR ** Expecting a macro header. Found instead: ÐÏ à¡±, ** ERROR ** No macro program in the file." when I try to run a local or global macro that was written in Microsoft Word?

These errors will appear when you try to run a local or global macro written in Microsoft Word if the macro is not saved in "Text only (*.txt)" format. Below are two ways to save the macro file 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 extension in double-quotes (for example, "MYMACRO.MAC").
  4. From the Save as type drop-down menu, choose Text Only (*.txt). Click Save.
    Note

    If you get a message that 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.

  5. Close Microsoft Word.

Option 2

  1. Copy and paste the contents of the macro from Microsoft Word into Notepad.
    Note

    To open Notepad, click on the Start menu and choose Programs > Accessories > Notepad.

  2. Choose File > Save As.
  3. In File name, enter the name of the macro including the .MAC file extension in double-quotes (for example, "MYMACRO.MAC"). Click Save.

Why do I get "* ERROR * Subcommand ___ is out of sequence or is not valid with this command. * ERROR * Subcommand ignored." when I try to create certain graphs?

The GSTD command must have been issued. The GSTD command enables character (standard) graphics, and thus disables high-resolution (professional) graphics. To return to professional graphics, at the command prompt (MTB >) in the Session window, type:

GPRO
Note

To display the command prompt, activate the Session window and choose Editor > Enable Commands.

When I try to run a macro from the Minitab Macros Library, I get the following error messages: * ERROR * Argument is a constant or matrix, but a column was expected. * ERROR * Macro exiting

This error message commonly occurs when running a macro that prompts the user for input in the Session window while Session window command language is disabled. To enable command language:
  1. Click in the Session window to make it the active window.
  2. Choose Editor > Enable Commands

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

By using this site you agree to the use of cookies for analytics and personalized content.  Read our policy