wa'alaikumussalam wr wb

pakai vba, dan pakai winapi ya...
1. disebuah module general, copas script ini :
Private Type ByteKeyboard
    arrKBD(0 To 255) As Byte
End Type

#If VBA7 Then
    Private Declare PtrSafe Function GetKeyState Lib "user32" (ByVal
nVirtKey As Long) As Long
    Private Declare PtrSafe Function GetKeyboardState Lib "user32" (kbArray
As ByteKeyboard) As Long
    Private Declare PtrSafe Function SetKeyboardState Lib "user32" (kbArray
As ByteKeyboard) As Long
#Else
    Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As
Long) As Long
    Private Declare Function GetKeyboardState Lib "user32" (kbArray As
ByteKeyboard) As Long
    Private Declare Function SetKeyboardState Lib "user32" (kbArray As
ByteKeyboard) As Long
#End If

Private byteKBD As ByteKeyboard

Public Sub MengOnken(Optional bState As Boolean = False)
    GetKeyboardState byteKBD
    byteKBD.arrKBD(20) = CByte(Abs(bState))
    SetKeyboardState byteKBD
End Sub

2. di module Thisworkbook, buat event workbook open, lalu isi dengan bunyi
script berikut :
         MengOnken  true   'untuk meng-on-ken capslock secara paksa

3. kalau pengen sebelum workbook di tutup si capslock dipaksa off :
    > masih di module thisworkbook, buat event beforeclose, isi dengan
script :
         MengOnken  false   'untuk meng-off-ken capslock secara paksa





On Tue, Feb 4, 2020 at 8:52 AM It Dpm it_...@yahoo.com [belajar-excel] <
belajar-excel@yahoogroups.com> wrote:

>
>
> assalamu'alaikum wr.wb
>
>
> yth, mr. master beexceller
> saya ingin menanyakan tentang kasus yaitu saya ingin mengaktifkan tombol
> capslock pada saat membuka file excel, jika capslock mati maka dihidupkan
> tp jika capslock sudah hidup maka dibiarkan saja.
>
> terima kasih sebelumnya atas bantuan para master
>
> 
>

Kirim email ke