943,708 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 19011
  • VB.NET RSS
Aug 16th, 2004
0

VB and Excel Programming

Expand Post »
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:

VB.NET Syntax (Toggle Plain Text)
  1. Sub HideSheet()
  2. Sheets("Sheet2").Visible = xlVeryHidden
  3. 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
Similar Threads
Team Colleague
Reputation Points: 121
Solved Threads: 57
Posting Virtuoso
kc0arf is offline Offline
1,629 posts
since Mar 2004
Aug 16th, 2004
0

Re: VB and Excel Programming

Quote 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:

VB.NET Syntax (Toggle Plain Text)
  1. Sub HideSheet()
  2. Sheets("Sheet2").Visible = xlVeryHidden
  3. 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.
Reputation Points: 16
Solved Threads: 1
Posting Whiz in Training
mnemtsas is offline Offline
200 posts
since Jul 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: How to sort the rows in the datagrid and update it successfully?
Next Thread in VB.NET Forum Timeline: Need Help for identify the Sorting Action





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC