+ Reply to Thread
Results 1 to 6 of 6

Application.SendKeys F1

  1. #1
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Application.SendKeys F1

    Greetings,
    I am having issues using the Application.SendKey F1. I have entered the following code and then close the workbook. When I open the workbook, the command area of the ribbon is hidden - all good. But when I close the workbook and open another workbook, the command area is still hidden. And when I open the original workbook (with the following code), the command area is shown.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Application.SendKeys F1

    Hello brentjohn,

    You really shouldn't rely on SendKeys for this. The Ribbon hide/show command toggles the Ribbon depending on it's state. If it is showing then it is minimized. If it is minimized then it is hidden.


    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Application.SendKeys F1

    Leith,
    Thank you much for your response.
    I replaced my code with your and when I tried closing the workbook I received a Run-time error '91': Object variable or With block variable not set.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Application.SendKeys F1

    Hello brentjohn,

    I forgot when using the Workbook Open event that you must use fully qualified constructs. Replace your code with the code below. It should take care of the problem.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Application.SendKeys F1

    Leith,
    That works great!
    Thank you much!

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Application.SendKeys F1

    Hello brentjohn,

    You're welcome. As many times as I have forgotten to do this in my own projects, I should have gotten it right the first time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. application.sendkeys shift+ctrl+enter
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-18-2014, 04:13 AM
  2. Application.Sendkeys for Mac Excel
    By nalgene5622 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-02-2012, 09:42 PM
  3. Application.sendkeys help
    By viruzman in forum Excel General
    Replies: 1
    Last Post: 03-26-2008, 10:13 PM
  4. Application.SendKeys stopped working
    By bondcrash in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-17-2007, 03:27 PM
  5. SendKeys to open application
    By Arne Hegefors in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-15-2006, 04:37 AM
  6. [SOLVED] Close an application with sendkeys
    By ina in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2006, 03:20 AM
  7. The application SendKeys
    By Jim333 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2005, 12:44 AM
  8. SendKeys and Application.ScreenUpdating
    By Michael Malinsky in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-23-2005, 07:06 PM

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