Hi All, need another favor. can you tell me how I should have this so it looks to see if the file is open and if the person's username matches?
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
If (Environ("UserName") = "e050308") Then
Workbooks("Convert NQ Pension from Tempe.xls").Close savechanges:=False
Else
do something else...
What I want is if the workbook was opened by "e050308" it must close without any changes. Or if it wasn't, then I don't get an error as I am now?
Is there some way to do an AND or OR as part of the code??
I have a half dozen or so usernames who can access the "Convert NQ Pension from Tempe.xls" and a couple of people who should not be allowed. I have a macro on auto_open that checks who they are and who can access the file but now I need to have the file close without saving ( it opens as read-only and must stay hidden) when then close the "primary" file. I don't even want them to know they are accessing this file so I don't even want the dialog box to open and ask if I want to save changes.
thanks
Walt
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
If (Environ("UserName") = "e050308") Then
Workbooks("Convert NQ Pension from Tempe.xls").Close savechanges:=False
Else
do something else...
What I want is if the workbook was opened by "e050308" it must close without any changes. Or if it wasn't, then I don't get an error as I am now?
Is there some way to do an AND or OR as part of the code??
I have a half dozen or so usernames who can access the "Convert NQ Pension from Tempe.xls" and a couple of people who should not be allowed. I have a macro on auto_open that checks who they are and who can access the file but now I need to have the file close without saving ( it opens as read-only and must stay hidden) when then close the "primary" file. I don't even want them to know they are accessing this file so I don't even want the dialog box to open and ask if I want to save changes.
thanks
Walt