Thread: file sharing
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Thunder[_2_] Thunder[_2_] is offline
external usenet poster
 
Posts: 2
Default file sharing


"Anna" ha scritto nel messaggio
...
I have files (with vba) that share with some users. Is it possible to
restrict the user certain time of using that file, automatically save and
close the file on the restricted time. Is it possible to know who is using
the file?
Thank you for your advise

Hello Anna,

excuse-me, but i'm italian and i don't speak a good english.
For the first question, i think you can use the following code:

==ThisWorkbook- Event Workbook_open==

Private Sub Workbook_Open()
If Time = #5:00:00 PM# Then
ThisWorkbook.Close '===is not necessary to save.
End If
End Sub

==ThisWorkbook-Event SheetSelectionChange==

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Application.ScreenUpdating = False

If Time = #5:00:00 PM# Then
With ThisWorkbook
.Save
.Close
End With
End If

Application.ScreenUpdating = True
End Sub

The problem is if person disable a macro when open your file.
For the second question, i don't have solution.

I hope to you it are useful.

Regads
Thunder