RunMacroSynchronization sets a timer when it's unable to run the SyncMacro but unfortunately there's an off-by-one error and the timer doesn't ever get killed:
It hangs excel and goes in an infinite loop, no exit point from Excel DNA to stop calling it.
Setting the timer (will always pass a timer ID of 0):
bool runOK = COMRunMacro(_syncMacroName);
if (!runOK && _timerId == 0)
// Timer not yet set - start it
// Timer will be stopped when SyncMacro actually runs.
IntPtr result = SetTimer(new HandleRef(_syncWindow, _syncWindow.Handle), timerId++, RETRY_INTERVAL_MS, IntPtr.Zero);
if (result == IntPtr.Zero)
// TODO: Handle unexpected error in setting timer
Debug.Print("SynchronizationWindow timer could not be set.");
Killing the timer (will always pass a timer ID of 1):
// Check for timer and disable
if (_timerId != 0)
KillTimer(new HandleRef(_syncWindow, _syncWindow.Handle), _timerId);
_timerId = 0;