In some situations its possible the Office application reject your call, in this case you got a RPC_E_CALL_REJECTED exception. The reasons for a reject can be different. The
office application is busy or its now allowed in current state. You may know this behaviour from MS Excel. Any programmatically access is prohibited when the user create or edit a cell formula.
The most common problem is you dont know the application is busy or not. A common solution is a delay and retry the call at hand. A lot of topics in the developer communitys shows you this way.(stackoverflow
A message filter is a manager for rejected calls (RPC_E_CALL_REJECTED) and gives you more control for these situation. A technical instruction can be found
The message filter can retry the rejected operation for you. You dont have to change your existing code and your code is more safety. NetOffice contains a ready-to-use MessageFilter implementation.
Overview - NetOffice.Settings.MessageFilter
||enable or disable the messagefilter
||specify the retry behaviour
||specify the log behaviour.
Example in Visual Basic
NetOffice.Settings.MessageFilter.Enabled = True
' set few milliseconds delay for retry
NetOffice.Settings.MessageFilter.RetryMode = NetOffice.RetryMessageFilterMode.Delayed
Example in C#
NetOffice.Settings.MessageFilter.Enabled = true;
// set few milliseconds delay for retry
NetOffice.Settings.MessageFilter.RetryMode = NetOffice.RetryMessageFilterMode.Delayed;