title: Interop Powerpoint,
body: <p>I want to insert a picture in powerpoint and I am facing this error :</p>
  
  <blockquote>
    <p>(1. Solution exception:CustomLayouts (unknown member) : Integer out of
    range. 36 is not in the valid range of 1 to 11.)</p>
  </blockquote>
  
  <p>The problem is located this part of the code:</p>
  
  <pre><code>PowerPoint.CustomLayout Cus01 = pr01.SlideMaster.CustomLayouts[PowerPoint.PpSlideLayout.ppLayoutPictureWithCaption];
  </code></pre>
  
  <p>The <code>pplayoutPictureWithCaption</code> has a number 36.<br>
  Any Ideas ??</p>
  
  <pre><code>if (trigger[0] == true)
  {
      //Create a project
      Microsoft.Office.Interop.PowerPoint.Application app = new Microsoft.Office.Interop.PowerPoint.Application();
      app.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
  
      //Create a presentation in thie project
      Microsoft.Office.Interop.PowerPoint.Presentations pre = app.Presentations;
      Microsoft.Office.Interop.PowerPoint.Presentation pr01 = pre.Add(Microsoft.Office.Core.MsoTriState.msoTrue);
  
      Microsoft.Office.Interop.PowerPoint.Presentation pr02 = app.ActivePresentation;
  
      //Create a slide in the project
      Microsoft.Office.Interop.PowerPoint.Slides sl = pr02.Slides;
      Microsoft.Office.Interop.PowerPoint.CustomLayout Cus01 = pr01.SlideMaster.CustomLayouts[Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutPictureWithCaption];
      Microsoft.Office.Interop.PowerPoint.Slide sl01 = pr02.Slides.AddSlide(1, Cus01);
  
  
      //Insert Picture
      Microsoft.Office.Interop.PowerPoint.Shape shape = sl01.Shapes[2];
      sl01.Shapes.AddPicture("D:\\AliceProject\\sd.jpg", Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse, 1, 1, 3, 3);
  }
  </code></pre>