Having a winforms UI and VBA UI in the same application ( Excel in my case ) has problem when the VBA UI is modal and is hidden.
I have created a Office shared .net addin or VSTO application add-in. This add-in adds a button to Office UI ( 2003, 2007... ). Clicking on the button opens a Winform UI. This UI is modeless and has button on it to hide. The instance of the UI is saved and if it is not disposed - show(-- excel window as owner -- ) is used to display it.
When there is a VBA add-in in Excel which has userform set as modal. This vba add-in also adds a button to Office Excel UI. When clicking on the button, it opens the modal UI and there is a button on the UI to hide it. Hiding this UI, later on causes the Winform UI unresponsive to user input.
I have used spy++ and uispy tools to view the status of the UI. The message sequence shows that the winforms UI is deactivated when there is a hidden modal vba form.
If there are only Winform UI with similar stuff ( modal and modeless mixed, with hide/show being used ) - then this problem does not happen.
If there are only VBA add-ins with userforms this problem does not happen.
This seems to happen only when VBA has webbrowser control. Here's most of the vba code:
Private Sub CommandButton1_Click()
Private Sub UserForm_Activate()
ThisWorkbook adds a command to the office UI:
.Style = msoButtonIconAndCaption
.TooltipText = "TESTER"
.Picture = picPicture
.OnAction = ThisWorkbook.Name & "!ShowUI"
.Enabled = True