Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default 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   Report Post  
Posted to microsoft.public.excel.programming
CFS CFS is offline
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
CFS CFS is offline
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Restrict access to only one sheet stewart Excel Programming 4 February 3rd 08 05:06 PM
Restrict open access Tung D Excel Worksheet Functions 1 November 2nd 07 11:39 AM
Restrict Access upon Opening? Alan Smith Excel Discussion (Misc queries) 3 February 13th 07 12:44 AM
Restrict access to certain sheets Jelinek Excel Discussion (Misc queries) 3 May 11th 06 08:10 PM
how do I restrict access to only one worksheet in excel? Avinash Excel Discussion (Misc queries) 5 March 21st 06 03:28 AM


All times are GMT +1. The time now is 04:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"