Health & Medical Disability

How to Access the SendKeys Function

    • 1). Click the Windows "Start" button and select "All Programs." Click "Microsoft .NET Framework," then click "Visual Studio" to open the VB compiler. Open your VB project after VS opens.

    • 2). Double-click the VB form you want to edit in the "Solution Explorer" panel on the right. In the file, scroll down to the function you want to use for your "SendKeys" call.

    • 3). Open the external application. The following code uses the "Shell" class to open the Windows command prompt:

      Shell "cmd", vbNormalFocus

      The "vbNormalFocus" constant variable sets the focus to the new application, which is required to send key strokes to the software.

    • 4). Type the "SendKeys" function to send key strokes to the application. In this example, the command "dir" is sent to the command prompt, which displays a list of directories on the computer:

      SendKeys "dir"

Leave a reply