Your cart is empty

Simple Key Logger in Excel


Simple Key Logger in Excel

Key loggers can be very complex and full of features; this key logger is not one of them. The purpose of this simple key logger is to demonstrate how you can use the Windows API user32.dll to capture keystrokes typed in any application from within Excel using VBA.

I have added few extra bits to make it interesting to play with such as auto emailing of the key log to a specified email address, and the option to hide the Excel application while the logger is running (stealth mode). These additional features are for fun and will not make the logger undetectable. For example the emails sent by the logger can be found in the Sent Items folder of the users Outlook application.  Also you can see Excel running in the Task Manager. Of course adding additional coding can overcome these down falls but this is not what I set out to do.

The key logger will correctly detect these characters:

A-Z, a-z, 1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,0 ,! ,@ ,# ,$ ,% ,^ ,& ,* ,( ,) ,_ ,+ , Enter and Space.

All other keyboard buttons may or may not be detected depending on what they are - from those that are detected they may appear as ASCI characters. The VBA project of this file is unlocked and if you want to map all possible keyboard buttons then you can do so by adding the additional code. There are 255 possible keys and I mapped most the common ones.

The code in this project is designed to demonstrate few concepts, you may want to use part of the code, all of it, add and modify it. To get you started I have added few user options. On the first sheet of the workbook you can see the below menu.

  • Send To – Enter the email address the key log will be emailed to
  • Flush Every (characters) – The key logger can email the log either at the end of its running cycle or every set number of characters have been detected. Enter the number of characters to detect and email. For example if you enter 200 then an email is sent every 200 logged characters 
    Auto Run When Open – If set to yes then the logger will start automatically when the file is opened and the macros have been enabled. Set to No to run manually.
  • Hide Excel While Running – If set to YES the Excel application will be hidden while the logger is running. Once the logger ends its cycle the Excel application will re-appear.
  • Close Excel When Finished – If set to YES then the Excel application will close at the end of the key logger cycle
  • Run For (hh:mm:ss) – Enter the duration for the key logger cycle. For example 00:00:15 will make the key logger run for 15 seconds then stop
  • Run Manually – Press this button to start the key logger manually

This macro was tested in Windows 7 / Excel 2007 and should work with most versions of Office. The macro is provided as is; no responsibility or liability will be taken what so ever.

  • 1 Units in Stock

Please Choose:


Current Reviews: 1

This product was added to our catalog on Saturday 07 April, 2012.

Customers who bought this product also purchased...