LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default how do i enable user logins

thanks for helping me Jim.

I must be way over my head with this. How do I incorporate this to the
codes you provide yesterday? can you give me a sample code?

thanks

"Jim Thomlinson" wrote:

You are absolutely correct on the environ("UserName")... sorry...

For the password thing you need to add a text boxes to a user form. The
biggest trick is to change the PasswordChar Property to * (if this does not
make sense to me just reply back for further info.

Now add a command button to the form. The code for the button will be
something like

if TextBox1.text = "MyPassword" then
unload me
else
msgBox "Password Incorrect. Please try again."
endif

You also need to handle the deactivate and terminate events to validate the
passowrd. Finally you need to give them a way to get if they do not have a
password such that the workbook closes. If you need more help with that just
let me know...
--
HTH...

Jim Thomlinson


"slacky75" wrote:

Thanks Jim. I tried your codes but had to change a typo
(Environ("USERNAME")). In any case, the codes you provided works by denying
access to the workbook for users not on the list.

I guess i was a bit vague in my question. I want a pop up window asking for
login name and password. can you help me with this?

Thanks

"Jim Thomlinson" wrote:

Excel security is easily defeated at the best of time so anything you do can
be defeated if your end users are motivated to do so. That being said, my
preference is to create a list of allowed users on a hidden sheet within the
book. I then use the Workbook_Open event to check the users login name
against the list of allowed names. Something like this...

Private Sub Workbook_Open()
Dim rng As Range

Set rng = Sheets("Sheet1").Cells.Find(What:=Environ.UserName , _
LookAt:=xlWhole, _
MatchCase:=False)
If rng Is Nothing Then
MsgBox "The name was not found. Time to close the book."
ThisWorkbook.Close False
End If
End Sub

Note that it is looking for your windows login name... I like this method
because it is easy and you do not have to remember passwords and such. If you
want a password solution then I would recommend taking the excel file and
doing a save as and then using Tools - General Options to attach a password
(which is actually very good protection).
--
HTH...

Jim Thomlinson


"slacky75" wrote:

I'm trying to create an excel template that will require users login inorder
to use the spread sheet. How would I go about doing that? Any help will be
great. Thanks



 
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
Prompting user to enable a link Rob Moore Excel Discussion (Misc queries) 0 February 10th 09 03:04 PM
Excel 2000 required multiple user name and password logins ISTech Excel Programming 0 August 23rd 05 08:19 PM
Required multiple user name and password logins for database query ISTech Excel Discussion (Misc queries) 0 August 22nd 05 09:53 PM
Limited logins Bruise Excel Worksheet Functions 0 May 24th 05 12:51 AM
How do I have excel not to prompt user to disable or enable a micro victor Excel Programming 2 January 9th 04 03:28 AM


All times are GMT +1. The time now is 02:03 PM.

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

About Us

"It's about Microsoft Excel"