ducngoc.kpmg
Thành viên mới
- Tham gia
- 24/6/19
- Bài viết
- 8
- Được thích
- 0
Đoạn code dưới đây máy em báo lỗi ở Option Explicit. nhưng chạy trên máy bạn em thì lại được. anh chị xem giúp e vì sao máy e lại bị lỗi ạ
em cám ơn
Option Explicit
'*********************************************************************************************
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private isFocus As Boolean, isClose As Byte, Usr As Variant, Pwd As Variant
'*********************************************************************************************
Private Sub Label3_Click()
End Sub
Private Sub UserForm_Initialize()
Workbooks(ThisWorkbook.Name).Activate
Application.EnableCancelKey = xlErrorHandler
Application.Visible = False
Dim hWnd As Long
On Error Resume Next
hWnd = FindWindow("ThunderDFrame", Me.Caption)
SetWindowLong hWnd, -16, &H84080080
Me.Height = 130
Usr = Nguon.[H2].Value
Pwd = Nguon.[H3].Value
txtUser = Usr
With txtPassword
.SetFocus: .SelStart = 0: .SelLength = Len(.Text)
End With
End Sub
em cám ơn
Option Explicit
'*********************************************************************************************
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private isFocus As Boolean, isClose As Byte, Usr As Variant, Pwd As Variant
'*********************************************************************************************
Private Sub Label3_Click()
End Sub
Private Sub UserForm_Initialize()
Workbooks(ThisWorkbook.Name).Activate
Application.EnableCancelKey = xlErrorHandler
Application.Visible = False
Dim hWnd As Long
On Error Resume Next
hWnd = FindWindow("ThunderDFrame", Me.Caption)
SetWindowLong hWnd, -16, &H84080080
Me.Height = 130
Usr = Nguon.[H2].Value
Pwd = Nguon.[H3].Value
txtUser = Usr
With txtPassword
.SetFocus: .SelStart = 0: .SelLength = Len(.Text)
End With
End Sub