#1
|
|||
|
|||
SendKeys doesn't work reliably
I have a simple visual basic program that adds a blank comment to a cell and then should open the comment for editing. It adds the blank comment correctly, but it opens the comment only about half the time (more or less randomly). I think the problem is that sometimes - but not always! - the Active Cell loses focus so it doesn't receive the SendKeys output. Is there a way to insure that the Active Cell stays active?
Code:
Sub AddBlankComment() ActiveCell.AddComment ("") ' Adds blank comment SendKeys "+{F2}", True ' Excel shortcut (shift-F2) to open comment for editing ' (True causes program to wait for action to complete.) End Sub |
#2
|
|||
|
|||
I've since made a number of changes outside of the above subroutine, and lately it's been working flawlessly. Unfortunately I don't know exactly what change fixed it, nor if the problem will stay fixed, but for the moment everything is good. (I'd delete this post if I could see how to do it.)
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SHIFT+END doesn't work | derohanes | Excel | 2 | 09-28-2015 09:31 AM |
HelpViewer doesn't work | dherr | Office | 1 | 03-27-2015 07:44 AM |
alt+numeric doesn't work | Kungen | Word | 3 | 12-02-2011 11:25 AM |
CNTL+X doesn't work | ACA | Office | 3 | 09-19-2011 10:42 AM |
Password Doesn't Work | cdarling | Outlook | 0 | 10-08-2009 10:15 AM |