View Single Post
  #2   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming
Philo Hippo Philo Hippo is offline
external usenet poster
 
Posts: 9
Default username & password check

Hi Jack,

create a small form with 2 fields, one for the username the other for the
password.
Call it up from the ThisWorkbook.Workbook_Open event and search for the
username then match the password.

sub cmdOKButton()

with sheet3.UsedRange
CurRow=1

Do Until IsEmpty(Cells(CurRow, 1)) 'Syntax:
Cells(RowIndex,ColumnIndex)
if Cells(CurRow, 1).value=txtUserName.text then
if Cells(CurRow, 2.value=txtPassword.text then
sheets("sheet1").activate
unload me
else
msgbox "the password provided is incorrect,
please try again"
txtPassword.setfocus
end if
else ' Username not found
msgbox "I'm sorry you do seem to be a registered user,
please contact the Administrator"
unload me ' or thisworkbook.close or application.quit
end if
CurRow=CurRow+_1
Loop
end with

end sub

"Jack" wrote in message
...
Hi,
I have a workbook of which I have usernames (column A:A) and passwords
(column B:B) on Sheet3. I have some tables, forms etc. on Sheet1 but I

want
to allow using this page to people only which can input matching
username&password with Sheet3. Can anyone suggest VBA solutions?.
TIA