View Full Version : Solved: Excel Security

11-22-2007, 05:29 AM
I wonder if you can help me (as you have done so well for me in the past!).
I am using the undernoted code (amongst a bundle of other code) to ensure that only authorised users can get access to an excel file. I am doing this is 3 levels - password, computername and where a file is recognised as being on the user's pc/laptop. The password code runs elsewhere and is fine. The code below is a "test" code for the other two stages. When it recognsises that the computername is ok and the file is there, it works fine. When it fails to recognise the username, I get the error message but the application does not close down, it moves on to the second check, and when it finds the file I get the success message - but then the application closes down. Why does it not close down at the first error??

If Environ("computername") = "DMONEY" Or Environ("computername") = "DMONEY." Or Environ("computername") = "FARQY" Or Environ("computername") = "FARQY." Then
MsgBox "Success1"
MsgBox "Fail1"
Application.DisplayAlerts = False
End If
If FileFolderExists("C:\Database\client\FIFdata.mdb") Then
MsgBox "Success2"
MsgBox "Fail2"
End If
End If

Your help as always is appreciated greatly


11-22-2007, 06:20 AM
Have you tried with an Exit Sub after the Application.Quit line?

11-29-2007, 10:34 AM
Sincere apologies for the delay in responding

As ever, the most annoying problems have very simple solutions.

Thank you

:clap: :doh: