I am writing a VSTo application and want both the animation pane and selection pane to open on startup. I have the following code written on the ribbon. load section
If Not Globals.ThisAddIn.Application.CommandBars.GetPressedMso("AnimationCustom") Then
Globals.ThisAddIn.Application.CommandBars.ExecuteMso("AnimationCustom")
End If
If Not Globals.ThisAddIn.Application.CommandBars.GetPressedMso("SelectionPane") Then
Globals.ThisAddIn.Application.CommandBars.ExecuteMso("SelectionPane")
End If
And it keeps generating the following code
-2147467259 Error HRESULT E_FAIL has been returned from a call to a COM component.
I thought it was because there was no powerpoint presentation opened so I added the following but no luck
Dim ppApplication As PowerPoint.ApplicationClass = Nothing
Dim ppPresentation As PowerPoint.Presentation = Nothing
Dim ppSlide As PowerPoint.Slide = Nothing
ppApplication = New Microsoft.Office.Interop.PowerPoint.ApplicationClass()
ppPresentation = ppApplication.Presentations.Add
ppSlide = ppPresentation.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutTitleOnly)
Globals.ThisAddIn.Application.ActiveWindow.ViewType = PpViewType.ppViewNormal
Thoughts?