Results 1 to 3 of 3

Thread: Excel 97 - Sheets Tabs Rows Collumns

  1. #1

    Thread Starter
    Lively Member TheFIDDLER's Avatar
    Join Date
    May 2002
    Location
    here and there and far away
    Posts
    126

    Excel 97 - Sheets Tabs Rows Collumns

    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:
    1. If ActiveWindow.DisplayHeadings = true then ActiveWindow.DisplayHeadings = false
    2. 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:
    1. ActiveWindow.DisplayHeadings = false
    2. 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. ...

  2. #2
    Addicted Member
    Join Date
    Dec 2001
    Posts
    158
    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.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    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
    Attached Files Attached Files
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width