Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to restrict access
Hi,
I am looking for a macro to run in an excel file so that when you open the file it pops up with a message, this file is being edited you cannot access this at this time and when you press ok the excel file will close. Can any one give me some help on this. Regards |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to restrict access
Use a Workbook event:
Private Sub Workbook_Open() MsgBox "This file is being edited you cannot access this at this time" ThisWorkbook.Close False End Sub -- CFS "santaviga" wrote: Hi, I am looking for a macro to run in an excel file so that when you open the file it pops up with a message, this file is being edited you cannot access this at this time and when you press ok the excel file will close. Can any one give me some help on this. Regards |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to restrict access
Excellant Thanks.
"CFS" wrote: Use a Workbook event: Private Sub Workbook_Open() MsgBox "This file is being edited you cannot access this at this time" ThisWorkbook.Close False End Sub -- CFS "santaviga" wrote: Hi, I am looking for a macro to run in an excel file so that when you open the file it pops up with a message, this file is being edited you cannot access this at this time and when you press ok the excel file will close. Can any one give me some help on this. Regards |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to restrict access
Just noticed that this works but how do I the administrator get access again
to remove the macro Regards "CFS" wrote: Use a Workbook event: Private Sub Workbook_Open() MsgBox "This file is being edited you cannot access this at this time" ThisWorkbook.Close False End Sub -- CFS "santaviga" wrote: Hi, I am looking for a macro to run in an excel file so that when you open the file it pops up with a message, this file is being edited you cannot access this at this time and when you press ok the excel file will close. Can any one give me some help on this. Regards |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to restrict access
Try this:
Private Sub Workbook_Open() Dim adminpass As String adminpass = InputBox("Enter admin password:") If adminpass < "1234" Then MsgBox "This file is being edited you cannot access this at this time" ThisWorkbook.Close False Else ThisWorkbook.Activate End If End Sub -- CFS "Terielad" wrote: Just noticed that this works but how do I the administrator get access again to remove the macro Regards "CFS" wrote: Use a Workbook event: Private Sub Workbook_Open() MsgBox "This file is being edited you cannot access this at this time" ThisWorkbook.Close False End Sub -- CFS "santaviga" wrote: Hi, I am looking for a macro to run in an excel file so that when you open the file it pops up with a message, this file is being edited you cannot access this at this time and when you press ok the excel file will close. Can any one give me some help on this. Regards |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to restrict access
Great Thanks.
"CFS" wrote: Try this: Private Sub Workbook_Open() Dim adminpass As String adminpass = InputBox("Enter admin password:") If adminpass < "1234" Then MsgBox "This file is being edited you cannot access this at this time" ThisWorkbook.Close False Else ThisWorkbook.Activate End If End Sub -- CFS "Terielad" wrote: Just noticed that this works but how do I the administrator get access again to remove the macro Regards "CFS" wrote: Use a Workbook event: Private Sub Workbook_Open() MsgBox "This file is being edited you cannot access this at this time" ThisWorkbook.Close False End Sub -- CFS "santaviga" wrote: Hi, I am looking for a macro to run in an excel file so that when you open the file it pops up with a message, this file is being edited you cannot access this at this time and when you press ok the excel file will close. Can any one give me some help on this. Regards |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to restrict access
What if the file is not being edited at this time?
Gord Dibben MS Excel MVP On Thu, 22 Jan 2009 11:19:02 -0800, Terielad wrote: Excellant Thanks. "CFS" wrote: Use a Workbook event: Private Sub Workbook_Open() MsgBox "This file is being edited you cannot access this at this time" ThisWorkbook.Close False End Sub -- CFS "santaviga" wrote: Hi, I am looking for a macro to run in an excel file so that when you open the file it pops up with a message, this file is being edited you cannot access this at this time and when you press ok the excel file will close. Can any one give me some help on this. Regards |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Restrict access to only one sheet | Excel Programming | |||
Restrict open access | Excel Worksheet Functions | |||
Restrict Access upon Opening? | Excel Discussion (Misc queries) | |||
Restrict access to certain sheets | Excel Discussion (Misc queries) | |||
how do I restrict access to only one worksheet in excel? | Excel Discussion (Misc queries) |