I am having this exact issue https://social.msdn.microsoft.com/Forums/vstudio/en-US/e417e686-032c-4324-b778-fef66c7687cd/excel-customtaskpane-with-webbrowser-control-keyboar
Q: Provide a more detailed explanation as to why this works so I can understand it better
Glad you got it working! To perform a root cause analysis we'd need to see where that 528 message gets sent and we'd need the Microsoft Excel source code to do that.
I don't think its worth spending anymore time troubleshooting it or working out why it happens because IT IS A BUG! Logging a Connect bug to help Microsoft fix it is the best thing you can do. We can only work around it, it's a problem in their source code.
It is quite rare you find these scenario's in VSTO to see bugs and you've certainly found one; where a user enters text input into an Add-Ins textbox and the message flows into a cell in the worksheet!! In my situation; where the message wasn't pumped to the Calendars_SelectedChange()
event. So we can see a bit of a theme of the behavior forming here that Hans explains well (Quoting from the Q&A I linked to in my comment):
What's never not a problem (ie can often be problematic) is that you rely on the message pump in Excel to dispatch Windows messages, the messages that make these controls respond to input. This goes wrong in WPF as much as Winforms, they have their own dispatch loop that filters messages before they are delivered to the window. Key things that go wrong when their respective dispatcher isn't used are stuff like tabbing and short-cut keystrokes.
And then some, this kind of problem would be induced by Excel doing its own filtering before dispatching messages. I'd guess at an anti-malware feature, Microsoft is forever worried about programs messing with Office apps.
And dont forget the VSTO WPF Connect case with menu's not receiving click events. The workaround involved using the DispatcherFrame to pump messages and subscribe to GotFocusEvent and LostFocusEvent for the menu.
So the bug is to do with controls that respond to input and the void WndProc(ref Message m)
messages being incorrectly filtered or redirected in the dispatch loop.