Tutorial..ICT
12.6K subscribers
7.73K photos
400 videos
757 files
1.13K links
Kongsi idea tentang ICT
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
TUTORIAL 170: MEMBINA LOG IN PASSWORD DALAM EXCEL MENGGUNAKAN VBA
Assalamualaikum dan salam Sejahtera..Dah lama senyap sunyi...Malam ni kita akan belajar cara buat Log In untuk Excel menggunakan VBA
Sebelum kita mulakan pelajaran malam ni pastikan anda telah buka fail excel dan aktifkan Menu Developer
Menu Developer > Visual Basic > Insert UserForm
Dengan menggunakan fungsi LABEL, TextBox dan CommandButton, sila design frame anda ikut kreativiti masing-masing
Klik Kanan dekat UserFrm1 > View code
Private Sub CommandButton1_Click()
Dim Username, password As String
Username = TextBox1.Text
password = TextBox2.Text
If Username = "admin" And password = "admin" Then
MsgBox "You entered the CORRECT info", vbInformation
Unload Me
Else
MsgBox "You entered the WRONG info", vbCritical
ActiveWorkbook.Close False
End If
End Sub
Copy and paste code berikut bermula "Dim Username" sehingga "End If"
Kemudian Klik Kanan dekat ThisWorkbook > View code
Private Sub Workbook_Open()
Application.Visible = False
UserForm1.Show
End Sub
Copy and Paste semua coding diatas
P/S anda boleh tukar username dan password pada coding pertama tadi "admin" (tukar yang dalam" " sahaja)
Kita cuba run excel kita tadi ye