Application.SendKeys (Excel)

Sends keystrokes to the active application.

This method places keystrokes in a key buffer. In some cases, you must call this method before you call the method that will use the keystrokes. For example, to send a password to a dialog box, you must call the SendKeys method before you display the dialog box. The Keys argument can specify any single key or any key combined with Alt, Ctrl, or Shift (or any combination of those keys). Each key is represented by one or more characters, such as "a" for the character a, or "{ENTER}" for the Enter key. To specify characters that aren't displayed when you press the corresponding key (for example, Enter or Tab), use the codes listed in the following table. Each code in the table represents one key on the keyboard.

SendKeys (Keys, Wait)


Dim strKeys As String: strKeys = "%fx"
SendKeys Keys:=strKeys

Arguments

The following argument is required

Keys (String) - The key or key combination that you want to send to the application, as text.

Optional arguments

The following argument is optional

Wait (Boolean) - True to have Microsoft Excel wait for the keys to be processed before returning control to the macro. False (or omitted) to continue running the macro without waiting for the keys to be processed.