Morningstar Add-In: VBA Guide 5
This is the code to run the call every 60 minutes.
Caution: Frequent calls (1 minute or less) to the server might cause a degradation of the server
speed and may temporarily prevent the application from running properly. Please use caution when
setting recurring intervals.
To cancel the run on time subroutine, use the following subroutine.
Process time
Morningstar Add-In libraries could affect process times for other VBA programs running
simultaneously within Excel. In some circumstances, the following codes can decrease latency by
disabling any commands in the workbook that are running in the Morningstar Add-In:
Disable/Enable Ribbons and Buttons
The Morningstar Add-In checks each active cell in the Excel worksheet. This interaction allows the
program to highlight the appropriate ribbon button if a cell contains an Add-In function.
During calculations that involve large numbers of cells or arrays, this process can slow response
time. If the Morningstar Add In is causing a delay, then disabling this interaction could improve
response time. It is important to keep or return this option to ON, in order to utilize full functionality
of the program. The directions to turn the ribbon interactions on and off are listed below:
Dim lNum As Long
Sub RunOnTime()
dTime = Now + TimeSerial(0, 60, 0) ' add the amount of delay here
Application.OnTime dTime, "RunOnTime"
Set cmd = Application.CommandBars("Cell").Controls("Refresh All")
cmd.Execute
End Sub
Application.OnTime dTime, "RunOnTime", , False
End Sub