Using SendKeys in a SalesLogix VBScript

At times in SalesLogix, there is just no other way to get something done without the use of SendKeys. I’m no fan of SendKeys, but it can be a necessary evil at times. Those times are less and less with the changes made in 6.1.1 and 6.2 with new exposed properties and methods for Active Forms. However, the need may still arise and you need to be prepared for it.

Using SendKeys allows you to send keystrokes to the screen, as if the user has clicked on something or typed something from the keyboard. It is easy to do, but you must use caution with using SendKeys as the results are uncontrollable and can be unreliable. Avoid it when you can. If they think you need to use it then rethink the design. But in the end, you may still need to use it. Warnings aside, to use SendKeys in VBScript, you must use the WScript.Shell object.

Dim objSh

Set objSh = CreateObject("WScript.Shell")

'Example sending TAB key
objSh.SendKeys "{TAB}", False

'Example sending ALT+F5
objSh.SendKeys "%{F5}", False


Set objSh = Nothing

The second parameter (where False is being passed in the example above) is used to indicate whether or not to wait until the keys sent have been processed. You can read the MSDN scripting documentation on using SendKeys here:

Using the SendKeys method in scripts


Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!