Results 1 to 5 of 5

Thread: [RESOLVED] Excel - Disabled Macros

  1. #1

    Thread Starter
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    Resolved [RESOLVED] Excel - Disabled Macros

    My spreadsheet needs the macros to work correctly.
    Is it possible to use the IF statement in a cell to work out if the macros are disabled or not?
    I was thinking of some sort of conditional formatting that would put in big letters "Enable the macros!" if the sheet was open with the macros disabled.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Excel - Disabled Macros

    A simple way would be to have that in the cell by default and if macros are enabled then have a small macro to clear that cell. So if no macros are enabled it will be left in the cell so they can read it.

    If not i'll look into seeing if there is anyother way.
    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

  3. #3

    Thread Starter
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    Re: Excel - Disabled Macros

    Backward thinking! I like it!

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Excel - Disabled Macros

    My dyslexia is finally paying off.

    I couldnt find anything that would help on this.
    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

  5. #5

    Thread Starter
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    Re: Excel - Disabled Macros

    I created a sheet with a big message on it then
    On Open I hid it and unhid the other sheets
    On Close I hid the other sheets and unhid the message sheet.

    That way it looks normal if you enable macros and has only a message if the macros are disabled
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Workbook_Open()
    4.     'Make the sheets visible if the macros are enabled
    5.     Sheets(2).Visible = True
    6.     Sheets(3).Visible = True
    7.     Sheets(4).Visible = True
    8.     'Hide the disabled macro sheet
    9.     Sheets(1).Visible = False
    10.  
    11. End Sub
    12.  
    13. Private Sub Workbook_BeforeClose(Cancel As Boolean)
    14.     'Show the disabled macro sheet
    15.     Sheets(1).Visible = True
    16.     'Hide all the proper sheets so that a macro must open them
    17.     Sheets(2).Visible = False
    18.     Sheets(3).Visible = False
    19.     Sheets(4).Visible = False
    20.     'Save the workbook
    21.     Me.Save
    22. End Sub

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