+ Reply to Thread
Results 1 to 3 of 3

Macro Enable/Disable

  1. #1
    Marcus B
    Guest

    Macro Enable/Disable

    Hi,

    I am trying to ensure that a user can only use my spreadsheet if they enable
    macros. I have used the workbook close event to set all the useful sheets to
    veryhidden and have a warning sheet visible advising that they must enable
    macros.

    The problem is that the workbook open event that sets the warning sheet to
    veryhidden does not immediately hide the sheet. How can I ensure that the
    user dosen't see this sheet if they have enabled the macros.

    Private Sub Workbook_Open()
    Application.ScreenUpdating = False
    Sheet.Visible = xlSheetVisible
    Sheet28.Visible = xlSheetVisible
    Sheet27.Visible = xlSheetVisible
    Sheet6.Visible = xlSheetVeryHidden
    Call ExitEditMode '(sub also has Application.ScreenUpdating = True/false).
    Application.ScreenUpdating = True
    End Sub

    thanks
    Marcus

  2. #2
    Bob Phillips
    Guest

    Re: Macro Enable/Disable

    You can't absolutely avoid it, but you could make it shorter by changing
    screenupdating .

    Private Sub Workbook_Open()
    Sheet.Visible = xlSheetVisible
    Application.ScreenUpdating False
    Sheet28.Visible = xlSheetVisible
    Sheet27.Visible = xlSheetVisible
    Sheet6.Visible = xlSheetVeryHidden
    Call ExitEditMode '(sub also has Application.ScreenUpdating = True/false).
    Application.ScreenUpdating = True
    End Sub


    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Marcus B" <Marcus [email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I am trying to ensure that a user can only use my spreadsheet if they

    enable
    > macros. I have used the workbook close event to set all the useful sheets

    to
    > veryhidden and have a warning sheet visible advising that they must enable
    > macros.
    >
    > The problem is that the workbook open event that sets the warning sheet

    to
    > veryhidden does not immediately hide the sheet. How can I ensure that the
    > user dosen't see this sheet if they have enabled the macros.
    >
    > Private Sub Workbook_Open()
    > Application.ScreenUpdating = False
    > Sheet.Visible = xlSheetVisible
    > Sheet28.Visible = xlSheetVisible
    > Sheet27.Visible = xlSheetVisible
    > Sheet6.Visible = xlSheetVeryHidden
    > Call ExitEditMode '(sub also has Application.ScreenUpdating = True/false).
    > Application.ScreenUpdating = True
    > End Sub
    >
    > thanks
    > Marcus




  3. #3
    Marcus B
    Guest

    Re: Macro Enable/Disable

    Thanks Bob,
    Marcus

    "Bob Phillips" wrote:

    > You can't absolutely avoid it, but you could make it shorter by changing
    > screenupdating .
    >
    > Private Sub Workbook_Open()
    > Sheet.Visible = xlSheetVisible
    > Application.ScreenUpdating False
    > Sheet28.Visible = xlSheetVisible
    > Sheet27.Visible = xlSheetVisible
    > Sheet6.Visible = xlSheetVeryHidden
    > Call ExitEditMode '(sub also has Application.ScreenUpdating = True/false).
    > Application.ScreenUpdating = True
    > End Sub
    >
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from email address if mailing direct)
    >
    > "Marcus B" <Marcus [email protected]> wrote in message
    > news:[email protected]...
    > > Hi,
    > >
    > > I am trying to ensure that a user can only use my spreadsheet if they

    > enable
    > > macros. I have used the workbook close event to set all the useful sheets

    > to
    > > veryhidden and have a warning sheet visible advising that they must enable
    > > macros.
    > >
    > > The problem is that the workbook open event that sets the warning sheet

    > to
    > > veryhidden does not immediately hide the sheet. How can I ensure that the
    > > user dosen't see this sheet if they have enabled the macros.
    > >
    > > Private Sub Workbook_Open()
    > > Application.ScreenUpdating = False
    > > Sheet.Visible = xlSheetVisible
    > > Sheet28.Visible = xlSheetVisible
    > > Sheet27.Visible = xlSheetVisible
    > > Sheet6.Visible = xlSheetVeryHidden
    > > Call ExitEditMode '(sub also has Application.ScreenUpdating = True/false).
    > > Application.ScreenUpdating = True
    > > End Sub
    > >
    > > thanks
    > > Marcus

    >
    >
    >


+ 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