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

-------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top