Excel is a spreadsheet program included in the Microsoft Office suite of productivity software. It is commonly available on PCs and Macs. In a spreadsheet, the data is managed through a series of tables where each value is placed in a separate cell. The values can be manipulated through the built-in functions or through custom functions written in Visual Basic (VBA). SendKeys is a method to capture key strokes in VBA.
Things You'll Need
- Microsoft Excel with VBA
Open Excel and then press ALT+F11 to open VBA.
Click "Insert" then "Module" from the menu bar to insert a new module. The method can also be used in a current module. A module is simply a segment of programming code for VBA.
Insert the function where you want to use the SendKeys method. All function must begin with "Function" and end with "End Function".
To access the SendKeys method, type "Application.SendKeys(" then the keys as a string and close the method with ")". This will the send the keys to the application just as if the user had typed the keys on the keyboard.
Tips & Warnings
- Some anti-virus programs will delete VBA macros and modules without warning. Certain methods are more susceptible to deletion, and SendKeys is one of the these methods. Check the anti-virus documentation about such actions by the anti-virus program.
- Photo Credit Hemera Technologies/AbleStock.com/Getty Images
How to Fill a Web Form Using Sendkeys
Automation can save you time and keystrokes by making your computer operate itself. Sendkeys, a useful utility built into Windows, gives you...
How Do I Create a Microsoft Excel Script?
Actions can be automated in Microsoft Excel using both macros and VBA scripting, and set to activate on-command or when a condition...
How to Calculate Standard Deviations in Excel Visual Basic
Excel is the spreadsheet program included in the Microsoft Office Suite of productivity software. A spreadsheet program manages data through a series...
How to Print a PDF Using VBA
Visual Basic Applications (VBA) designed by Microsoft use Visual6 programming language. It was created for developers to enable user-defined functions and automate...