Answered current slide show comments

  • Sunday, August 05, 2012 10:25 PM
     
     

    hi all, I share with all my application, I need a single detail.
    The idea is that when I change my PowerPoint slide show me the comments slide in my current

    works perfect in each slide just shows me the message 2 times andI need to display the message once.


    any ideas?


    public partial class ThisAddIn
        {
           
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {


                Application.SlideShowNextSlide +=new PowerPoint.EApplication_SlideShowNextSlideEventHandler(Application_SlideShowNextSlide);
                
                
                
            }

            private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
            {

     

            }

          
           void Application_SlideShowNextSlide(Microsoft.Office.Interop.PowerPoint.SlideShowWindow Wn)
            {
                Microsoft.Office.Interop.PowerPoint.Slide currentSlide = Wn.View.Slide;
                foreach (PowerPoint.Comment comment in currentSlide.Comments)
                {
                    MessageBox.Show(comment.Text);
                }
            }
          

            }





            #region VSTO generated code

            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InternalStartup()
            {
                this.Startup += new System.EventHandler(ThisAddIn_Startup);
                this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
            }

            #endregion

        }

    I need it for powerpoint 2007


    • Edited by Andre06 Sunday, August 05, 2012 10:56 PM
    • Edited by Andre06 Sunday, August 05, 2012 11:05 PM
    • Edited by Andre06 Sunday, August 05, 2012 11:10 PM
    •  

All Replies

  • Monday, August 06, 2012 3:04 PM
     
     Answered Has Code

    It would seem that the same text is present in two comments.

    You could get around that by changing the loop to:

    string lastComment = "";
    foreach (PowerPoint.Comment comment in currentSlide.Comments)
    {
      if (comment.text != lastComment)
        MessageBox.Show(comment.Text);
      lastComment = comment.text
    }