Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: SendKeys from a UserForm commandbutton

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    88
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    If I use:

    SendKeys ("%fdm")

    from a standard macro it works fine. However if I try to use the exact same code from a button on a Userform I see the file menu flash real quick but nothing happens. I even tried having the commandbutton on the userform call the macro and it won't work.

    If I put a form button on the sheet directly and assign the macro to it, it works. But if I try it from a Userform it just will not work?

    This one has me pulling my hair out..

    advance thanks

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Posts
    88
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I figured it out myself!!

    The menu item I was trying to call in Excel required a cell to be activated or the menu option was greyed out. So I had to change the code to:

    UserForm1.Hide
    Range("A1").Select
    SendKeys ("%fdm")

    Geez I HATE stuff like that..

    thanks anyway..

  3. #3
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi keith


    Setting the CommandButtons TakeFocus******* Property MAY have also worked.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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