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:
VB Code:
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
VB Code:
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.
-----
#VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP
I miss my VIC 20.
Never should have upgraded to my commodore 64. ...
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
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.