ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   file sharing (https://www.excelbanter.com/excel-programming/356149-file-sharing.html)

Anna

file sharing
 
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


Thunder[_2_]

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



irishboyx[_3_]

file sharing
 

to see who has the workbook open at any particular time click tools
share workbook , this will show you the usernames of people who hav
it opened (the username is located in the tools options genera
tab).

Unless you ask every one to change this username manually (only need
to happen once) it will probably just appear as a standard defaul
username for everyone

There is also a remove user option in shared workbook section (not on
network can not try it) not sure if that kicks them ou

--
irishboy
-----------------------------------------------------------------------
irishboyx's Profile: http://www.excelforum.com/member.php...fo&userid=3249
View this thread: http://www.excelforum.com/showthread.php?threadid=52287


Anna

file sharing
 
How can I restrict user to use the file for a period of time (e.g. 1 hour)
instead of close the file at a specific time (e.g. 5:00 pm)


Thunder,
Thank you for your help. Your code assists me force user to close file.
That's great.


"Anna" wrote:

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


NickHK

file sharing
 
Anna
In the WB_Open event you could:
Application.OnTime DateAdd("h", 1, Now()), TimeToClose

Personally I would find this very annoying, so I hope you have a good reason
for doing so.
Make sure you give the user warning what is going to happen, so they chance
to finish whatever they are doing.

NickHK

"Anna" wrote in message
...
How can I restrict user to use the file for a period of time (e.g. 1 hour)
instead of close the file at a specific time (e.g. 5:00 pm)


Thunder,
Thank you for your help. Your code assists me force user to close file.
That's great.


"Anna" wrote:

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




Anna

file sharing
 
Nick,
Thank you for your reply. I got a runtime error when I use below coding.

Run-time error €˜1004;
Method €˜OnTime of object_application failed

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!
Anna

"NickHK" wrote:

Anna
In the WB_Open event you could:
Application.OnTime DateAdd("h", 1, Now()), TimeToClose

Personally I would find this very annoying, so I hope you have a good reason
for doing so.
Make sure you give the user warning what is going to happen, so they chance
to finish whatever they are doing.

NickHK

"Anna" wrote in message
...
How can I restrict user to use the file for a period of time (e.g. 1 hour)
instead of close the file at a specific time (e.g. 5:00 pm)


Thunder,
Thank you for your help. Your code assists me force user to close file.
That's great.


"Anna" wrote:

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






All times are GMT +1. The time now is 11:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com