Microsoft KB Archive/11113

From BetaArchive Wiki

Autoexec Macro in Infinite Loop PSS ID Number: Q11113 Article last modified on 07-21-1988 PSS database name: D_MPlan

2.x 3.00 3.01 3.02 3.04

MS-DOS

Summary: If you use an autoexec macro to load a SYLK file, the macro may go into an infinite loop. This occurs because when a SYLK file is loaded, it is merged with the current worksheet (in this case, the one running the autoexec macro). After a new file is loaded, Multiplan always looks for an autoexec macro and executes it if it is found. In this case, the one it finds is the one that is set up to load the SYLK file; it then proceeds to load the file a second time. Thus, unless the autoexec macro is overwritten by some part of the SYLK file when the SYLK file is first loaded (merged), the macro causes an infinite loop.

More Information: If you have to use an autoexec macro to load a SYLK file, the autoexec macro can be set up to test whether the SYLK file has already been loaded by doing one of the following:

  1. Have the macro confirm the existence of a field that only exists in the SYLK file.
  2. Place the autoexec macro where it will be overwritten by the SYLK file when it is loaded.

You can set a flag in the macro to determine if the SYLK file has been loaded by doing the following:

name this cell “load” —> 0 define this cell as —> ‘IFload=1’’QU a macro named GNload’RTV1’RT “autoexec” TOS’RTTL<filename>’RT

This will load the SYLK file whose name is specified in the file

name and set the flag “load” to 1. On the second pass, the macro will terminate without trying to load the SYLK file a second time.

Copyright Microsoft Corporation 1988.