Results 1 to 4 of 4

Record date of opening a workbook, together with user name

Threaded View

  1. #3
    Valued Forum Contributor
    Join Date
    05-03-2022
    Location
    Halifax,Canada
    MS-Off Ver
    365
    Posts
    326

    Re: Record date of opening a workbook, together with user name

    Hello lost_astronaut

    One thing that you have to take into account is that the user should be forced to open workbook with macro's enabled.
    For if the user opens workbook without macro's enabled you will not get a macro recording you login information.

    ONE WAY TO ACHIEVE THIS ...
    - on closing have macro hide and lock all sheets except for a "splash sheet"
    - the "splash sheet " in big bold print tells them to open book with macros enabled
    - the "on open" macro trigger , if macros are enabled, macro is triggered automatically to hide splash sheet and unhide / unprotect all other sheets.
    - if user does not enable macros on open only sees splash sheet ELSE , if enabled sees all sheets but flash sheet


    Code to "forced to open workbook with macro's enabled"
    Const SPLASH_SHEET_NAME = "DisabledNotice"
    
    Private Sub Workbook_Open()
       changeSheetState xlSheetVeryHidden, xlSheetVisible
    End Sub
    
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
       changeSheetState xlSheetVisible, xlSheetVeryHidden
    End Sub
    
    Private Sub changeSheetState(flashSheetState, otherSheetsState)
        Dim wksh As Worksheet
        With Application
        .ScreenUpdating = False
        Sheets(SPLASH_SHEET_NAME).Visible = xlSheetVisible
        For Each wksh In ThisWorkbook.Sheets
            If wksh.name <> SPLASH_SHEET_NAME Then
                wksh.Visible = otherSheetsState
            End If
        Next wksh
        Sheets(SPLASH_SHEET_NAME).Visible = flashSheetState
        .ScreenUpdating = True
        End With
    End Sub

    if this has helped please consider clicking "add reputation" , thx
    Last edited by nimrod1313; 08-29-2022 at 11:16 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Log/Record every user of a workbook
    By rakotonirinas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-16-2017, 05:41 AM
  2. Opening a workbook already open by another user
    By KASM in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-24-2010, 06:47 AM
  3. Only opening a workbook by User Name or Machine Name???
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-20-2006, 11:52 AM
  4. [SOLVED] Macro to record user name and date/time
    By Maddoktor in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-18-2005, 07:00 AM
  5. [SOLVED] Macro to record user name and date/time
    By Maddoktor in forum Excel General
    Replies: 0
    Last Post: 12-08-2005, 06:10 PM
  6. [SOLVED] Opening workbook in user-defined folder
    By pdberger in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 09:05 AM
  7. Opening a user selected workbook
    By David Hall in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2005, 04:06 PM

Tags for this Thread

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