Solved

VB SendKey Problem

Posted on 1999-01-20
4
304 Views
Last Modified: 2006-11-17
I am currently automating the edit comment procedure within Excel 97 using VB.  I am using the SendKey command to enter text into a comment field:
Application.SendKeys ("%IE")
This works successfully but the menu remains active on the window and requires a "return" to disappear and activate the comments window.  I have tried using variations on the following:
Application.SendKeys ("%IE {ENTER}")
to try and resolve this, all to no avail.

Best regards,

Rob.
0
Comment
Question by:ecj1
  • 2
  • 2
4 Comments
 

Author Comment

by:ecj1
ID: 1615842
Edited text of question
0
 
LVL 12

Accepted Solution

by:
jgv earned 50 total points
ID: 1615843
You could try splitting the action and have the VB app wait until the first set of keys are processed ("%IE", True) before sending the ENTER key.

Application.SendKeys "%IE", True
Application.SendKeys "{ENTER}", True


0
 
LVL 12

Expert Comment

by:jgv
ID: 1615844
ecj1:

For some reason sending Enter as {ENTER} does not work in this case. Use:

Application.SendKeys "%IE~"

The ~ is recognized as the ENTER key and does work.
0
 

Author Comment

by:ecj1
ID: 1615845
jgv,

many thanks for you help.

ecj1
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Some time ago I was asked to create a VBA function that would calculate a check digit for an input number, using the following procedure: First, sum up all the individual digits in the number If that sum value has more than one digit, then sum up …
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now