ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Login (https://www.excelbanter.com/excel-programming/412287-login.html)

robin

Login
 
Hello guys

I need help creating a macro that would act as a login form for the workbook.
the macro would validate the id and password from another workbook.
Can anyone please help me with this?

Thanks and Regards
Robin

joel

Login
 
sub CheckLogin

PassWordFName = "C:\MyFolder\Password.xls"

Account = inputBox("Enter Account : ")
PassWd = inputbox("Enter Password : ")

'Open Password File
set PassWdBk = workbooks.open(filename:=PassWordFName)
with PassWdBk.Sheets("Sheet1")
set CheckAccnt = .Columns("A").Find _
(what:=Account,lookin:=xlvalues,lookat:=xlwhole)
if CheckAccnt is nothing then
msgbox("Did not find account")
else
OldPassword = CheckAccnt.offset(0,1).value 'get password from col B
if PassWd = OldPassword then
msgbox("Password Matched")
else
msgbox("Password did not match")
end if
end if
end with

PassWdBk.close savechanges:=False
end sub

"Robin" wrote:

Hello guys

I need help creating a macro that would act as a login form for the workbook.
the macro would validate the id and password from another workbook.
Can anyone please help me with this?

Thanks and Regards
Robin



All times are GMT +1. The time now is 04:44 PM.

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