This project has moved and is read-only. For the latest updates, please go here.

PowerPoint.Application reference is null using GetHostItem

Apr 3, 2013 at 12:29 AM
Hi, I'm converting a Powerpoint Addin using the traditional interop assemblies to NetOffice.

I've updated references everywhere to refer to the NetOffice objects, and my project now compiles again, but fails at runtime trying to get a reference to the current PowerPoint.Application object.

A snippet of the failing code is below. PowerPoint refers to NetOffice.PowerPointApi, whereas before it referred to Microsoft.Office.Interop.PowerPoint.

This is code generated by the designer tool in visual studio, so I don't know if I should keep using the GetHostItem or what.

Any clues welcome.
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "")]
        protected override void Initialize() {
            this.Application = this.GetHostItem<PowerPoint.Application>(typeof(PowerPoint.Application), "Application");
            if (this.Application == null)
                MessageBox.Show("Application is null :-(");
            Globals.PowerPointAddin = this;