Simulating Key Presses in Macros

  • Thread starter Thread starter aswini.ks
  • Start date Start date
A

aswini.ks

Hi,

How do I simulate pressing the keys using a macro in Excel. For
example, if I want to simulate pressing the keys Alt+H+A, what should I
do in the macro?

Thanks.
 
Try something like:

Private Sub CommandButton1_Click()
Application.SendKeys ("%ha")
End Sub

If you execute from the vb editor, you get the About box for Visual
Basic, but this brings up about for Excel.
 
If it is the About dialog you want to invoke then


Code
-------------------

Sub About()
Application.CommandBars.FindControl(ID:=927).Execute
End Sub

-------------------
 
Back
Top