Re: Who opens my file?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Apr 30, 5:57 pm, cht13er <cht1...@xxxxxxxxx> wrote:
On Apr 29, 11:39 am, ryguy7272 <ryguy7...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:





This method works great:

Private Sub Auto_Open()

    LogInformation ThisWorkbook.Name & " opened by " & _
    Application.UserName & " " & Format(Date, "yyyy-mm-dd") & " " &
Format(Time, "hh:mm")

End Sub

Sub LogInformation(LogMessage As String)
Const LogFileName As String = "C:\MyLog.txt"
Dim FileNum As Integer
    FileNum = FreeFile ' next file number
    Open LogFileName For Append As #FileNum ' creates the file if it doesn't
exist
    Print #FileNum, LogMessage ' write information at the end of the text file
    Close #FileNum ' close the file
End Sub

Both macros go into a standard module.
Then, place a text file on your C: drive (in C:, right-click > New > Text
Document > name it 'MyLog').

Regards,
Ryan---
--
RyGuy

"cht13er" wrote:
On Apr 28, 3:23 pm, Ken <krco...@xxxxxxx> wrote:
Chris

In similar situations I have created a logging system where certain
events trigger the writing of data to a text file.  If all the copies
of your app will be running on a network, and if there is a spot on
the network that all the users have access to, it is pretty easy to
open the text file and write whatever data you are interested in to
the text file.  The writing process could be triggered by the file
open event or file close event and simply write the user name and the
time.  Below is a sample where logging and the location of the log
file are controlled by variables  in named worksheet cells.  The Print
line in your case could include the username, time and whatever else
you desire instead of the stuff I have in the example.  Also, in your
case you may be better off hardcoding the location of the log file and
eliminating the option to suppress the logging.  Unless you have a
particularly slow network, the logging activity should be barely
noticable.

    If Range("Enable_logging") = True Then
    fName = Range("Path").Value & Range("Log_file").Value
    On Error GoTo EndMacro:
    fnum = FreeFile
    Open fName For Append Access Write As #fnum
        Print #fnum, cName, "Created Export file", "with " & x; "
records", , Now
EndMacro:
        On Error GoTo 0
        Application.ScreenUpdating = True
        Close #fnum
    End If

You could actually trigger a process that generates an e-mail, and if
the potential users, including bootleg users are not on a network, you
may have to resort to something along that line.  If they are
networked though, I supspect you will be happier just tracking
activity and avoiding auto generated e-mail.

Good luck.

Ken
Norfolk, Va

On Apr 28, 1:31 pm, cht13er <cht1...@xxxxxxxxx> wrote:

Good day, thanks for your comments and replies!

I've created a large-scale application with Excel VBA and I would like
to keep track of who uses the program. Because there is always the
possibility that someone made a copy of the file and is working off of
their version, creating a list of users on an xlVeryHidden sheet
wouldn't work...because it's hard to know where the original file
ended up.

I would like to know if there is any way to automatically fire off a
quasi-email .... or how in the world I can approach this!

Thanks for your help!

Chris

Thanks for the reply, Ken. I think I'll set it up just as you have
suggested.

Chris- Hide quoted text -

- Show quoted text -

ryguy - The .txt file won't be on my local C drive - but on the
company's network drive. The problem I have is when the network is
unavailable (perhaps no internet connection, perhaps someone pirated a
copy and isn't on our network, etc) ... and trying to decide how to
manage those users, too! But I guess for the short-term I can set up
this writing to a network drive's .txt file ... and if the file is
unavailable just let the program continue.

Thanks

Chris- Hide quoted text -

- Show quoted text -

In the log file, you may also include the information of the current
file path.
With this you will know if the user has his own copy of the file
somewhere else.

Regards,
Madiya
.



Relevant Pages

  • Re: Home wireless free hotspot
    ...   To the SWAT team, ... Subject: Home wireless free hotspot ... agreed upon in order to access the network. ... Securing Apache Web Server with thawte Digital Certificate ...
    (Security-Basics)
  • Re: God Mode In Windows 7
    ... the word "Network". ...     "Collects and stores network configuration ... computer because my registry is full of glue now. ... Microsoft Word (which is a part of Microsoft Office, ...
    (soc.retirement)
  • Re: God Mode In Windows 7
    ... the word "Network". ...     "Collects and stores network configuration ... computer because my registry is full of glue now. ... Soc.Retirement, "CapsUnlock" which disables the ...
    (soc.retirement)
  • Re: Fixing THE CW for 2012
    ... Plan B follows the previously crafted Plan A. ... cancel the network. ...   8:00 Gossip Girl ...   8:30 THE CARRIE DIARIES ...
    (rec.arts.tv)
  • Re: Who opens my file?
    ... Private Sub Auto_Open ... of your app will be running on a network, and if there is a spot on ... eliminating the option to suppress the logging. ...     On Error GoTo EndMacro: ...
    (microsoft.public.excel.programming)