Excel: Window Hide Command Different in Excel 4.0

ID: Q89175


The information in this article applies to:


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("C:\USER")
   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 "Save Changes in NAME.XLM" 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 "Save Changes in NAME.XLM" 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 "Save Change in NAME.XLM" 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 "Save changes" 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.


REFERENCES

"User's Guide," version 5.0, page 690
"User's Guide 2," version 4.0, page 191
"Function Reference," version 4.0, page 219

Additional query words: 5.0


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: March 26, 1999