PDA

Click to See Complete Forum and Search --> : Excel 97 - Sheets Tabs Rows Collumns


TheFIDDLER
Apr 25th, 2004, 09:50 PM
My current project involves trying to prevent the user from showing sheet tabs, and of revealing columns and rows.

I can hide the menus easily enough. I am looking to code within the program to trap the events, and to cancel them or to reset back to my original state.
I can code it as:

If ActiveWindow.DisplayHeadings = true then ActiveWindow.DisplayHeadings = false
If ActiveWindow.DisplayWorkbookTabs = true then ActiveWindow.DisplayWorkbookTabs = false

or simply - since the time it takes to check, it may as well perform the action

ActiveWindow.DisplayHeadings = false
ActiveWindow.DisplayWorkbookTabs = false

My question is as to the most efficient place to put it.
Any suggestions? Or if I can trap the events and only have the code run if needed.

Garratt
May 2nd, 2004, 10:17 PM
If you click on the workbook item you can create a "open" sub in there:

Private Sub Workbook_Open()
'code
End Sub


But, because of security issues of course the user only has to hold down the shift key as they click "enable macros" and the code doesn't execute.

I'm not sure how to keep a workbook from not opening if the macros aren't enabled.

RobDog888
May 6th, 2004, 12:54 PM
I have done something similar in Outlook. So I put together a
sample workbook for you. You need to add a class
(PublicNotCreatable) that gets instanciated upon the workbook
open and initializes its events. Then you can add your code to the
events as you see fit.

This demo will trap the right click and double click events. Also,
the sheet add event.

HTH