Article ID: 156879 - Last Review: January 19, 2007 - Revision: 3.5 OFF97: Visual Basic Modules Cannot Be Hidden or ProtectedThis article was previously published under Q156879 SYMPTOMS
In the programs listed at the beginning of this article, you cannot hide or
protect a module either manually or by using a macro.
CAUSE
In earlier versions of Microsoft Excel, macro sheets and Visual Basic modules are contained on tabs in a workbook. These tabs can be hidden or protected manually or using the Visible, Protect, or Unprotect commands in a macro. However, in the products listed at the beginning of this article, Visual Basic modules are displayed in the Visual Basic Editor.
WORKAROUND
You can protect the modules from being viewed by locking the project for viewing, providing a password, and then saving the file normally. NOTE: By doing this, you will not be able to save a Microsoft Excel workbook down to an earlier format. To protect a module from being viewed, follow these steps (or the appropriate ones for your version of Excel). NOTE: The following steps are for Microsoft Excel 97:
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104) Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice) For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms) The following sample procedures are provided to further clarify the difference between hiding modules in Microsoft Excel 5.0, 7.0, and 97. Microsoft Excel 5.0 and 7.0When you run the HideMe procedure, Microsoft Excel hides Module1. Running the ShowMe procedure unhides Module1. Running the ReallyHideModule2 procedure hides Module2 and prevents it from being unhidden without using a macro or code.Microsoft Excel 97Nothing happens when you run these sample procedures in Microsoft Excel 97. Because modules are not tabbed sheets, they no longer have a Visible property, and you cannot hide or unhide them.Similarly, using the Protect or Unprotect methods to protect or unprotect a module does not work in Microsoft Excel 97. Because modules are not tabbed sheets, you cannot protect or unprotect them. APPLIES TO
| Article Translations
|

Back to the top
