Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 07-03-2023, 07:48 AM
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

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.)
Reply With Quote
Reply



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 07:02 AM.


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