ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A password question (https://www.excelbanter.com/excel-programming/279354-password-question.html)

Andy Smith[_4_]

A password question
 
Hi,
my office is currently using Windows NT, but within months Windows XP
will be used.

I've made a timewokbook and want to protect it in such a way that only
I or the employee can open it.

My idea is
a) All employees have his/her own genuine server user_name. I want to
use this in a verification test.
b) I'm the section leader and shall have right of admission to all
timeworkbooks. My server user_name should be entered in cell A1 in
Sheet1 in all timeworkbooks. Each time I try to open the timeworkbook
from my own computer, a macro should compare the value entered in cell
A1 with the server user_name entered in the login window when the
computer is restarted every day.
c) The server user_name for each employee should be entered in cell B1
in Sheet1, and only in the file he/she use. The macro should compare
the value entered in cell B1 with the ser user_name entered in the
login window when the computer is restarted every day. The purpose is
that he/she should not be allowed to open the timeworkbook belonging
to other employees.

Could this be done?

Sincerely
Andy-s

Tom Ogilvy

A password question
 
Mr. Erlandsend's site:
http://www.erlandsendata.no/english/vba/os/index.php

has code for username and computer name.

---------------
Another example

From: Trevor Shuttleworth )
Subject: Code to show login name
Newsgroups: microsoft.public.excel.programming
Date: 2001-01-16 12:54:01 PST



Private Declare Function apiGetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpBuffer As String, nsize As Long) As Long

Sub GetUserNameTest()
MsgBox fOSUserName
End Sub

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX < 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = ""
End If
End Function

-------------------


Regards,
Tom Ogilvy



Andy Smith wrote in message
om...
Hi,
my office is currently using Windows NT, but within months Windows XP
will be used.

I've made a timewokbook and want to protect it in such a way that only
I or the employee can open it.

My idea is
a) All employees have his/her own genuine server user_name. I want to
use this in a verification test.
b) I'm the section leader and shall have right of admission to all
timeworkbooks. My server user_name should be entered in cell A1 in
Sheet1 in all timeworkbooks. Each time I try to open the timeworkbook
from my own computer, a macro should compare the value entered in cell
A1 with the server user_name entered in the login window when the
computer is restarted every day.
c) The server user_name for each employee should be entered in cell B1
in Sheet1, and only in the file he/she use. The macro should compare
the value entered in cell B1 with the ser user_name entered in the
login window when the computer is restarted every day. The purpose is
that he/she should not be allowed to open the timeworkbook belonging
to other employees.

Could this be done?

Sincerely
Andy-s





All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com