ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macros and Hotkeys (https://www.excelbanter.com/excel-programming/278900-macros-hotkeys.html)

Christopher Weaver

Macros and Hotkeys
 
The following code works fine when invoked with alt-f8, etc. But when I
assign a hotkey via the options dialog box and attempt to invoke it using
that hotkey, the last line is not executed or does not work. The comment is
created, and it is blank, but the user is not taken into the edit mode of
the comment. Any ideas?


Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment Text:=""
End If
SendKeys "%ie~"



Dave Peterson[_3_]

Macros and Hotkeys
 
Adding a slight delay worked ok for me:

Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment Text:=""
End If
Application.Wait Now + TimeSerial(0, 0, 1)
SendKeys "%ie~"



Christopher Weaver wrote:

The following code works fine when invoked with alt-f8, etc. But when I
assign a hotkey via the options dialog box and attempt to invoke it using
that hotkey, the last line is not executed or does not work. The comment is
created, and it is blank, but the user is not taken into the edit mode of
the comment. Any ideas?

Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment Text:=""
End If
SendKeys "%ie~"


--

Dave Peterson


Christopher Weaver

Macros and Hotkeys
 
Thank you, that works for me, as well.


"Dave Peterson" wrote in message
...
Adding a slight delay worked ok for me:

Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment Text:=""
End If
Application.Wait Now + TimeSerial(0, 0, 1)
SendKeys "%ie~"



Christopher Weaver wrote:

The following code works fine when invoked with alt-f8, etc. But when I
assign a hotkey via the options dialog box and attempt to invoke it

using
that hotkey, the last line is not executed or does not work. The

comment is
created, and it is blank, but the user is not taken into the edit mode

of
the comment. Any ideas?

Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment Text:=""
End If
SendKeys "%ie~"


--

Dave Peterson





All times are GMT +1. The time now is 06:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com