Read Only Workbook - How to Log who reads the workbook

upobDaPlaya
upobDaPlaya used Ask the Experts™
on
I have a Ready Only workbook that is available to 100 people.  I want to determine who uses the workbook.  However, I can not add code to the OnOpen event as since the Workbook is read only then my code can not write the users name to a cell.  My other concern is a macro may open this read only workbook and I do not want to impact any macros that may open this read only workbook and extract info..

Any suggestions on how I can figure out who uses the workbook without having to email all 100 individuals..
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Place your workbook behind a CMS which forces a login for access.

You'll know instantly.

Likely much easier to use a working CMS, like WordPress, than hand roll your own.

Author

Commented:
Whats a CMS...Whatever it is I think that solution would be problematic as if today am unaware that a macro opens this read only workbook and then out of nowhere I put up a CMS I assume the macro would fail ?
David FavorFractional CTO
Distinguished Expert 2018

Commented:
CMS == WordPress, Drupal, Joomla, 100s of others.

If you're new to CMS software, stick with WordPress.

With a CMS, you'd just setup your workbook as restricted content, so a person has to login to use your workbook. Then just track user stats.

You can also go a step further + break apart your workbook into separate content pages, to gather more granular data.

Read up on WordPress. You'll likely be surprised by all the features a CMS can provide for you.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Roy CoxGroup Finance Manager

Commented:
Maybe write to a text file. Create a text file named log, change the path in the code to suit

Option Explicit

Private Sub Workbook_Open()
    Dim sPath As String
    sPath = ThisWorkbook.Path & Application.PathSeparator & "log.txt"    ''///Change to your folder
    Open sPath For Append As #1
    Write #1, Application.UserName & " , " & Format(Now, "yyyy/mm/dd hh:mm")
    Close #1
End Sub

Open in new window

Group Finance Manager
Commented:
This will be better for multi users

Option Explicit


Private Sub Workbook_Open()
    Dim iHandle As Integer
    Dim sPath As String

    iHandle = FreeFile

    sPath = ThisWorkbook.Path & Application.PathSeparator & "Log.txt"    ''///Change as to your folder
    Open sPath For Append As iHandle
    Write #iHandle, Application.UserName & " ," & Format(Now, "yyyy/mm/dd hh:mm")
    Close #iHandle

End Sub

Open in new window

Author

Commented:
Hi Roy, what is the purpose of the ihandle...
Roy CoxGroup Finance Manager

Commented:
The VBA FreeFile function reserves the next available file number for VBA file input/output. When you open a file for writing or reading in VBA, you must refer to that file with a unique integer file number. The FreeFile function determines this unique file number for you so you can use it to open, read, and write files using VBA. It avoids a conflict if your chosen number has been used.

Author

Commented:
Thanks for the detail
Roy CoxGroup Finance Manager

Commented:
Pleased to help

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial