User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 402,549 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,278 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 14368 | Replies: 1
Reply
Join Date: Mar 2004
Posts: 1,514
Reputation: kc0arf is a jewel in the rough kc0arf is a jewel in the rough kc0arf is a jewel in the rough 
Rep Power: 10
Solved Threads: 48
Colleague
kc0arf kc0arf is offline Offline
Posting Virtuoso

VB and Excel Programming

  #1  
Aug 16th, 2004
Hello,

This might be in the wrong place. My question pertains to MS Excel, and using Visual Basic for Applications (VBA).

We have a user that would like to hide one of her worksheets within a workbook. She would like the sheet to be securely hidden.

I found this piece of code:

 Sub HideSheet()
    Sheets("Sheet2").Visible = xlVeryHidden
End Sub 

and the sheet does disappear.

There are two problems:

1) I don't like the Macro warning. Hints that something might be up, and if they disable the macros, then this visibility thing does not work.

2) Anyone can go into the Visual Basic for Applications menu, and see all of the worksheets in broad daylight. They can highlight the hidden sheet, and go to the properties, and unhide it with their mouse. Data revealed.


I am going to discuss with the user the wisdom of trying to do this. If she wants to go ahead though, and do "security through obscurity", then that is her call. What I want to be sure of though is that there isn't any other way to place a password on the VBA menu, or perhaps prevent the sheets from displaying on the VBA menu.

If anyone has ideas, please let me know. I am not very proficient in VBA, so please spell out the steps taken.

Thanks,

Christian
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2004
Location: Adelaide, Australia
Posts: 191
Reputation: mnemtsas is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 1
mnemtsas's Avatar
mnemtsas mnemtsas is offline Offline
Junior Poster

Re: VB and Excel Programming

  #2  
Aug 16th, 2004
Originally Posted by kc0arf
Hello,

This might be in the wrong place. My question pertains to MS Excel, and using Visual Basic for Applications (VBA).

We have a user that would like to hide one of her worksheets within a workbook. She would like the sheet to be securely hidden.

I found this piece of code:

 Sub HideSheet()
    Sheets("Sheet2").Visible = xlVeryHidden
End Sub 

and the sheet does disappear.

There are two problems:

1) I don't like the Macro warning. Hints that something might be up, and if they disable the macros, then this visibility thing does not work.

2) Anyone can go into the Visual Basic for Applications menu, and see all of the worksheets in broad daylight. They can highlight the hidden sheet, and go to the properties, and unhide it with their mouse. Data revealed.


I am going to discuss with the user the wisdom of trying to do this. If she wants to go ahead though, and do "security through obscurity", then that is her call. What I want to be sure of though is that there isn't any other way to place a password on the VBA menu, or perhaps prevent the sheets from displaying on the VBA menu.

If anyone has ideas, please let me know. I am not very proficient in VBA, so please spell out the steps taken.

Thanks,

Christian

You cannot disable the macro warning with a macro. No way around it, after all if there was then there would be no point it being there.

Second question, you can password protect your vba project so even if someone does go the the vba menu they will not see the modules or worksheets. Look under Tools->VBA Project properties from the VBA window.

Thirdly the code you've written above only needs to be used once. Why not set the worksheet to xlVeryHidden before you distribute it? You don't need to hide it every time you open the file. Once you've set it to xlVeryHidden and saved the file it's 'very hidden' until someone else makes it visible from another bit of vba code.

Hope that helps.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 9:05 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC