LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.officedev,microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Generic VB Code to Hide Spreadsheet

Is there a generic VB code that will hide all spreadsheets in a workbook but
one. I use this method to prevent users from using the file after disabling
macros. If they Disable Macros, all they see is a spreadsheet with a message
saying 'to use this file they have to Enable Macros'. When Macros are enable
and the file is closed/saved, all sheets, except the one with the message,
are made invisible and the workbook protected (locked), and when the file is
opened with Macros Enabled all sheets except the one with message are made
visible and the workbook is unlocked (not protected).

The problem is that a user can add a new spreadsheet to the workbook and the
code I use will not make the new spreadsheet invisible on closing. The code
I use is:

sheets("Sheet Name").visible=false

Is there a way to make all sheets invisible or a toggle command to reverse
the existing visible property for all sheets in a workbook? Or perhaps,
there is a better approach. Any assistance will be appreciated.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to Hide columns in spreadsheet but NOT hide data in chart. KrispyData Charts and Charting in Excel 1 March 20th 09 04:45 PM
Change a specific code to generic in VB macro Sue Excel Discussion (Misc queries) 2 April 23rd 08 06:56 PM
Connecting an excel spreadsheet to a generic letter in Word Christine Excel Discussion (Misc queries) 2 December 6th 06 10:20 PM
Generic protect/unprotect code through buttons and code? StargateFanFromWork[_3_] Excel Programming 4 December 31st 05 12:10 AM
VBA Code- Copy and paste into a generic text box Bourbon[_18_] Excel Programming 0 January 23rd 04 02:42 PM


All times are GMT +1. The time now is 02:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"