'Use SendKeys with variable vba

I have this code for every letter of the alphabet in the sub WorkBook_Open:

Application.OnKey "a", "'LetterPress ""a""'"

Then in a different module I have a sub: Sub LetterPress(B as String)

In the LetterPress sub there's a long If statement that closes with:

else
    Application.SendKeys(B)
End If

Basically, if none of the if statements trigger I just want to send the key, like if the OnKey command wasn't run.

It doesn't work though. It correctly enters the Else-part and Application.SendKeys(B) is run. But no letter is typed. How do I use SendKeys with a variable?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source