+ Reply to Thread
Results 1 to 2 of 2

Enabled macros

  1. #1
    Registered User
    Join Date
    10-24-2005
    Posts
    55

    Enabled macros

    Hi

    I have workbook that needs macros to be enabled i have found a thread see link below that displays a splash screen if macros are disabled BUT the code hides all the sheets and shows only the splash screen the problem i have is i have about 30 odd sheets that are hidden all the time and about 10 that are visable, how would are alter the code to suit my needs


    http://www.excelforum.com/showthread...ableing+macros

    Thanks

  2. #2
    Bob Phillips
    Guest

    Re: Enabled macros

    You could try this approach. Your sheets that you want permanently hidden,
    set them as xlSheetVeryHidden. Then add this code, which incidentally, also
    reverts things at the end

    Option Explicit

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Sheets("Splash").Visible = xlSheetVisible
    For Each sh In Sheets
    If sh.Name <> "Splash" Then
    If sh.Visible = xlSheetVisible Then
    sh.Visible = xlSheetHidden
    End If
    End If
    Next sh
    thisworkbbok.Save
    End Sub

    Private Sub Workbook_Open()
    Dim sh As Object
    For Each sh In Sheets
    If sh.Visible <> xlSheetVeryHidden Then
    sh.Visible = True
    End If
    Next sh
    Sheets("Splash").Visible = xlSheetVeryHidden
    End Sub


    'This is workbook event code.
    'To input this code, right click on the Excel icon on the worksheet
    '(or next to the File menu if you maximise your workbooks),
    'select View Code from the menu, and paste the code


    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "raw" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi
    >
    > I have workbook that needs macros to be enabled i have found a thread
    > see link below that displays a splash screen if macros are disabled BUT
    > the code hides all the sheets and shows only the splash screen the
    > problem i have is i have about 30 odd sheets that are hidden all the
    > time and about 10 that are visable, how would are alter the code to
    > suit my needs
    >
    >
    >

    http://www.excelforum.com/showthread...ableing+macros
    >
    > Thanks
    >
    >
    > --
    > raw
    > ------------------------------------------------------------------------
    > raw's Profile:

    http://www.excelforum.com/member.php...o&userid=28312
    > View this thread: http://www.excelforum.com/showthread...hreadid=493326
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1