title: How to Enable Macro settings thru code?
body: <p>I have created a Macro in a Powerpoint Presentation using the following code. When running this small piece of code I was getting an exception " programmatic access to visual basic project is not trusted". I know this can be resolved by changing the Trust Center Settings in options. But can anyone help me how I can change these settings thru code. ike any powerpoint interop APIs?? pl suggest.. Thanks in advance.</p>
  
  <p>My sample code:</p>
  
  <pre><code>PowerPoint.Application oPPT = new PowerPoint.Application();
  oPPT.Visible = Office.MsoTriState.msoTrue;
  
  //Add New Presentation
  PowerPoint.Presentations oPresSet = oPPT.Presentations;
  PowerPoint.Presentation oPres = oPresSet.Add(Office.MsoTriState.msoTrue);
  
  //Add Slides to the Presentation
  PowerPoint.Slides oSlides = oPres.Slides;
  PowerPoint.Slide oSlide = oSlides.Add(1, PowerPoint.PpSlideLayout.ppLayoutTitle);
  
  VBComponent vbc =  oPres.VBProject.VBComponents.Add(vbext_ComponentType.vbext_ct_StdModule);
  string code = "sub VBAMacro()\r\n" + "ActivePresentation.Close\n" + "End Sub";
  vbc.CodeModule.AddFromString(code);
  </code></pre>