শুক্রবার, ২৪ জুন, ২০১৬

Login - hide

Private Sub CommandButton2_Click()
 If TextBox1 = "robi" Then
 MsgBox "welcome"
 Application.Visible = True
 Unload Me
 Unload UserForm1
 Else
    MsgBox "Wrong Password"
 End If
 
 
End Sub
Private Sub CommandButton1_Click()
Unload Me
ActiveWorkbook.Close True
Application.Quit

End Sub
Private Sub Workbook_Open()
Application.Visible = False
UserForm1.Show

End Sub

শুক্রবার, ৩ জুন, ২০১৬

Login Form code

private....
dim username, password as string

username = textbox1.text
password = textbox2.text

if username = "myuser" and password = "mypassword" then
   msgbox "You entered the correct info", vbInformation
    Unload Me 'unload this form
else
     msgbox "You entered the wrong info", vbcritical
    'now close the workbook
    ActiveWorkbook.close
    
End if
End sub


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

private...
    'show the form when the workbook is open
    UserForm1.show
End sub