+ Reply to Thread
Results 1 to 4 of 4

Simulating Key Presses in Macros

Hybrid View

  1. #1

    Simulating Key Presses in Macros

    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.


  2. #2
    ward376
    Guest

    Re: Simulating Key Presses in Macros

    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.


  3. #3
    Registered User Ivan F Moala's Avatar
    Join Date
    10-25-2003
    Location
    Auckland, New Zealand
    Posts
    71
    If it is the About dialog you want to invoke then

    Sub About()
        Application.CommandBars.FindControl(ID:=927).Execute
    End Sub
    Kind Regards,
    Ivan F Moala From the City of Sails
    \1

  4. #4
    ward376
    Guest

    Re: Simulating Key Presses in Macros

    Ivan! Sweet! Where do you look for the ID numbers?


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1