Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-02-2023, 07:00 PM
coffent coffent is offline SendKeys doesn't work reliably Windows 10 SendKeys doesn't work reliably Office 2019
Advanced Beginner
SendKeys doesn't work reliably
 
Join Date: Dec 2019
Posts: 40
coffent is on a distinguished road
Default 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

Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
SHIFT+END doesn't work derohanes Excel 2 09-28-2015 09:31 AM
SendKeys doesn't work reliably HelpViewer doesn't work dherr Office 1 03-27-2015 07:44 AM
SendKeys doesn't work reliably 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:11 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft