[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


SendKeys in Excel Macros

Posted on 2001-08-10
Medium Priority
Last Modified: 2012-06-21
When I include the command
     SendKeys "^{HOME}"
in an Excel 97 macro, I got a "VBA5.dll Not Found" error.  I installed Visual Basic Service Pack 3, which contains the file -- same results.  Then I copied the file to c:\WINNT\system32 and now get a Dr. Watson every time I run the macro.  I'm using NT 4.0, SP6.  What's going on?  Is there an alternative command to do a Ctrl-Home?
Question by:EDC
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 17

Expert Comment

ID: 6374507

The alternative I see is more simple than the sendkeys, but I do not understand why you have never tried this.

Here it is:




Accepted Solution

sergeTD earned 800 total points
ID: 6376218
To make effective the use of
"SendKeys "{home}", True" and others "Sendkey" instructions, you have to use LOTUS navigation keys:
->Menu TOOLS->Options->Tab TRANSITION->select "Transition   Navigation KEYS".
Hope this helps.
Serge TD

Expert Comment

ID: 6376237
I have also to precise an important point:

To be effective, the sendkeys instructions must not be executed in VBA Debug mode(step by step), so use F5 rather than F8 if you launch your macro from the Vbasic Window.

Serge TD
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments


Author Comment

ID: 6379997
Thanks for your efforts!  However:

SergeTD, I launch my macro from a button on the spreadsheet.  And I turned on "Transition Navigation Keys" and still get the Dr. Watson.  (I even quit Excel and rebooted.)  And other users are getting the VBA5.dll error, too, even with "Transition Navigation Keys" on (I haven't bothered them further with taking them towards the Dr. Watson error).

Calacuccia, earlier in my macro I do some filtering and a freeze panes, so Ctrl-Home takes me to, for example, D880 -- but it may not be the same cell each time I run it..

Author Comment

ID: 6398841
Further investigation revealed that there is a problem with the particular workbook I am working with (it's the one that generates Dr. Watsons with MsgBox, OnTime, and who knows what else).  

When I used sergeTD's answer in another test workbook, it worked fine.  Thanks!

Expert Comment

ID: 6399937
I am pleased you have found a solution with my little help.
I am using very often Sendkeys and if you need more help
about them, just use a comment to this question: I will
try to help you furthermore.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question