Microsoft KB Archive/89175

{|
 * width="100%"|

Excel: Window Hide Command Different in Excel 4.0

 * }

-

The information in this article applies to:


 * Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0
 * Microsoft Excel for the Macintosh, versions 4.0, 5.0

-

SUMMARY
In Microsoft Excel version 4.0 and later, the Hide command found on the Window menu functions differently than it does in previous versions of Microsoft Excel. This may cause macros from previous versions of Microsoft Excel that use the HIDE command to produce a macro error when run in versions later than 3.0.

MORE INFORMATION
The following Auto_Open macro functions in Microsoft Excel versions 2.1 and 3.0, but may not work after the first time in later versions.

  A1: Auto_Open A2: =HIDE A3: =DIRECTORY(&quot;C:\USER&quot;) A4: =NEW A5: =RETURN

A2 hides the macro sheet, A3 changes the directory, and A4 opens a new sheet.

When exiting version 4.0 or 5.0 the first time this macro is run, the &quot;Save Changes in NAME.XLM&quot; dialog box is displayed for the macro sheet. If you answer yes to this request, the next time Microsoft Excel is opened, a macro error at occurs at line 1.

When you hide a document in version 4.0 or 5.0, Microsoft Excel flags the document as being changed and the &quot;Save Changes in NAME.XLM&quot; dialog box is displayed for the macro sheet when you exit the program. If you attempt to save in Microsoft Excel version 4.0 or 5.0, the program objects to hiding a sheet that is already hidden when it is opened the next time.

Hiding a document in Microsoft Excel 3.0 and 2.1 does not flag it as changed and no &quot;Save Change in NAME.XLM&quot; dialog box appears when exiting Microsoft Excel. When the macro is opened subsequently, the sheet is not hidden and the =HIDE command does not cause an error.

The macro without the =HIDE will work in all versions of Microsoft Excel if the macro is saved after the Window Hide command is issued. In earlier versions of Microsoft Excel, some other insignificant change, such as typing a space character in an empty cell, must be made to the macro sheet prior to hiding it. This will cause the &quot;Save changes&quot; dialog box to appear when exiting Microsoft Excel and the sheet will be saved as hidden and will reopen as hidden.

Note: the HIDE command in version 5.0 works the same way for macro sheets only. This macro example does not apply to version 5.0 module sheets.