ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro/Function for Keyboard button combinations (https://www.excelbanter.com/excel-programming/348762-macro-function-keyboard-button-combinations.html)

Matt

Macro/Function for Keyboard button combinations
 
I have a DDE link that pulls in certain information to my spreadsheet.
Occassionally the link goes down, but unless the user is really paying
attention they may not know the data is stale. When the user depresses
Ctrl+Shift+R, it refreshes the link (whether it is current or not), but I am
tired of people asking what the combination is (because they forget). I'd
like to:
a.) create a button that operates the keyboard stroke Ctrl+Shift+R
or (better)
b.) create a funtion that automatically launches the keyboard stroke at
timed intervals.

If possible as well, is there a way to set up a notification if the link is
down? (like a cell that contains the value "Live" when it is communicating
and "Dead" when it isn't)

Leith Ross[_407_]

Macro/Function for Keyboard button combinations
 

Hello Matt,

You can refresh the data automatically after a certain time has
elapsed. The DDE doesn't support a method of determining if it is
"Live" or "Dead". Add a new VBA module to your project and copy the
macros into it. The Refresh will happen every 15 seconds. You can
change this to whatever you need. The format is Hours:Minutes:Seconds.
In your code call "RefreshData" to start the automatic refresh.


Code:
--------------------

Sub RefreshData()

Application.OnTime Now() + TimeValue("00:00:15"), "DDERefresh"

End Sub

Sub DDERefresh

Application.SendKeys( "^+R")

End Sub

--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=495560



All times are GMT +1. The time now is 01:55 PM.

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