Excel cung cấp rất nhiều short cut,
http://www.cpearson.com/excel/ShortCuts.htm
Nhưng lại thiếu short cut cho name box.
Thủ tục VBA sau sẽ giúp các bạn có short cut để đi đến Name box:
(Bằng cách bạn tạo short cut cho thủ tục SetFocusNameBox)
Public Declare Function SetFocus Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, _
ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Sub SetFocusNameBox()
Dim Res As Long
Res = SetFocus( _
FindWindowEx( _
FindWindowEx( _
FindWindow("XLMAIN", Application.Caption) _
, 0, "EXCEL;", vbNullString) _
, 0, "combobox", vbNullString))
End Sub
Chúc các bạn thành công.
Tham khảo từ www.cpearson.com
Lê Văn Duyệt
http://www.cpearson.com/excel/ShortCuts.htm
Nhưng lại thiếu short cut cho name box.
Thủ tục VBA sau sẽ giúp các bạn có short cut để đi đến Name box:
(Bằng cách bạn tạo short cut cho thủ tục SetFocusNameBox)
Public Declare Function SetFocus Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, _
ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Sub SetFocusNameBox()
Dim Res As Long
Res = SetFocus( _
FindWindowEx( _
FindWindowEx( _
FindWindow("XLMAIN", Application.Caption) _
, 0, "EXCEL;", vbNullString) _
, 0, "combobox", vbNullString))
End Sub
Chúc các bạn thành công.
Tham khảo từ www.cpearson.com
Lê Văn Duyệt