+ Reply to Thread
Results 1 to 2 of 2

Two projects together? Force enable macros & Inactive kick out

  1. #1
    Registered User
    Join Date
    10-24-2014
    Location
    Leeds
    MS-Off Ver
    2007
    Posts
    0

    Question Two projects together? Force enable macros & Inactive kick out

    Hi Guys,

    I have the following two pieces im trying to stich together with no luck, they work fine on there own but not together.

    one is to force people to enable Macro's to unhide everything, and the second is a inactive kick out timer.

    'Force enable Macro's'

    Private Sub Workbook_Open()

    Dim ws As Worksheet

    For Each ws In ThisWorkbook.Worksheets

    ws.Visible = xlSheetVisible

    Next ws

    Sheets("START").Visible = xlVeryHidden


    End Sub

    Private Sub Workbook_BeforeClose(Cancel As Boolean)

    Dim ws As Worksheet

    Sheets("START").Visible = xlSheetVisible

    For Each ws In ThisWorkbook.Worksheets

    If ws.Name <> "START" Then

    ws.Visible = xlVeryHidden
    End If

    Next ws

    ActiveWorkbook.Save

    End Sub
    -------------------------------





    'Inactive kick out'

    Dim DownTime As Date
    --------------------------------

    Sub SetTime()
    DownTime = Now + TimeValue("00:10:00")
    Application.OnTime DownTime, "ShutDown"
    End Sub
    --------------------------------

    Sub ShutDown()
    ThisWorkbook.Save
    ThisWorkbook.Close
    End Sub
    --------------------------------

    Sub Disable()
    On Error Resume Next
    Application.OnTime EarliestTime:=DownTime, Procedure:="ShutDown", _
    Schedule:=False
    End Sub

    Thanks

    Jon

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166
    Hello Crash1982,

    Welcome to Excelforum. Be a part of large Excel community. Enjoy Learning.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Use of 'on time' to kick inactive users
    By TKCZBW in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-16-2014, 03:40 AM
  2. Kick out Inactive users except in read only
    By StephanieLilly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2013, 02:16 PM
  3. force enable macros lag
    By FRIEL in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-07-2009, 02:13 PM
  4. [SOLVED] Force to enable macros
    By Denys in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2006, 09:30 AM
  5. How can force enable macros to be able to open my workbook?
    By kcdonaldson in forum Excel General
    Replies: 3
    Last Post: 12-05-2005, 02:20 PM

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