Kamis, 27 Februari 2020

Re: [belajar-excel] Macro Capslock On

 


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 Thu, Feb 27, 2020 at 12:09 PM Andrie - sioean2@yahoo.com [belajar-excel] <belajar-excel@yahoogroups.com> wrote:
 

Suhu Excel,

Mohon bantuannya untuk macro excel auto on capslock
Thanks


__._,_.___

Posted by: "Mr. Kid" <mr.nmkid@gmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
============================================================
Pojok Lowongan Kerja yang disediakan milis :
http://milis-belajar-excel.1048464.n5.nabble.com/Pojok-Lowongan-Kerja-f5725753.html
*** Posting lowongan kerja : ke link tersebut dan klik New Topic
============================================================
bergabung ke milis (subscribe), kirim mail kosong ke: belajar-excel-subscribe@yahoogroups.com
posting ke milis, kirimkan ke: belajar-excel@yahoogroups.com
berkunjung ke web milis : http://tech.groups.yahoo.com/group/belajar-excel/messages
melihat file archive / mendownload lampiran : http://www.mail-archive.com/belajar-excel@yahoogroups.com/
atau (sejak 25-Apr-2011) bisa juga di : http://milis-belajar-excel.1048464.n5.nabble.com/
menghubungi moderators & owners: belajar-excel-owner@yahoogroups.com
keluar dari membership milis (UnSubscribe), kirim mail kosong ke : belajar-excel-unsubscribe@yahoogroups.com
---------------------------------------------------------------------

.

__,_._,___

Tidak ada komentar:

Posting Komentar