VSTO Excel solutions and disappearing Action Panes
If you are using Actions Panes in a VSTO Excel add-in you might have seen the following behavior. You create an new ActionPane, derived from UserControl, and add it to the Workbook ActionsPane.Controls collection. It shows up nicely so you think you are done.
Now the user creates a new Spreadsheet using File/New. Note that the ActionsPane disappears and remains hidden until the user reactivates it using View/Task Pane or Ctrl+F1.
So how do you automatically display the TaskPane when the user switched back to the original document? You need to add the following code to the ThisWorkbook type:
PrivateSub ThisWorkbook_WindowActivate(ByVal Wn As Window) HandlesMe.WindowActivate
Application.DisplayDocumentActionTaskPane = True
EndSub
Enjoy!