none
Refresh the slide overview programmatically in Powerpoint (Powerpoint 2007 / 2010, vba) RRS feed

  • Question

  • Hi,

    when I insert a footer into a slide with the text e.g. "Test" and then afterwards change the footer to the text e.g. "This is a test", the slides in the small slide overview don´t get refreshed and still shows the "Test" text. I first have to switch over to another view and then switch back.

    I think this behaviour is by design because it is the same in 2007 and 2010, but is there any possibility to update the small slide view programmatically?

    Thanks in advice

    Mark


    Viele Grüße Mark
    Monday, November 7, 2011 12:31 PM

Answers

  • Hi Mark,

    I try to reproduce the scenario on my side but failed, I can change the text of the footer without swithing over to another vew. And below is the simple VBA code snippet which I have tested:

    Sub ChangeText()
    Dim s As Slide
    Dim shp As Shape
    For Each s In ActivePresentation.Slides
        For Each shp In s.Shapes
            If shp.TextFrame2.TextRange.Text = "test" Then
                shp.TextFrame2.TextRange.Text = "This is a test"
            End If
        Next shp
    Next
    End Sub

    Please see whether this works well on your side with the code. If the scenario still persists on your side, please show me the detail reproducible step list.

    Hope this can help you and just feel free to follow up after you have tried.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Bruce Song Monday, November 21, 2011 12:42 PM
    • Unmarked as answer by Bruce Song Monday, November 21, 2011 12:42 PM
    • Proposed as answer by Bruce Song Monday, November 21, 2011 12:42 PM
    • Marked as answer by Bruce Song Friday, November 25, 2011 11:09 AM
    Wednesday, November 9, 2011 6:43 AM

All replies

  • Hi Mark,

    I try to reproduce the scenario on my side but failed, I can change the text of the footer without swithing over to another vew. And below is the simple VBA code snippet which I have tested:

    Sub ChangeText()
    Dim s As Slide
    Dim shp As Shape
    For Each s In ActivePresentation.Slides
        For Each shp In s.Shapes
            If shp.TextFrame2.TextRange.Text = "test" Then
                shp.TextFrame2.TextRange.Text = "This is a test"
            End If
        Next shp
    Next
    End Sub

    Please see whether this works well on your side with the code. If the scenario still persists on your side, please show me the detail reproducible step list.

    Hope this can help you and just feel free to follow up after you have tried.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Bruce Song Monday, November 21, 2011 12:42 PM
    • Unmarked as answer by Bruce Song Monday, November 21, 2011 12:42 PM
    • Proposed as answer by Bruce Song Monday, November 21, 2011 12:42 PM
    • Marked as answer by Bruce Song Friday, November 25, 2011 11:09 AM
    Wednesday, November 9, 2011 6:43 AM
  • Hi Bruce,

    I tried your code and it works.

    I access the footer directly on each slide (HeadersFooter.Footer.Text) and then the footer in the small slide overview (I don´t know whats the right name) will not be updated.

    Here`s how I do it. I reused your code

    Sub ChangeText()
    Dim s As Slide
    Dim shp As Shape
    For Each s In ActivePresentation.Slides
       
            If s.HeadersFooters.Footer.Text = "test" Then
                s.HeadersFooters.Footer.Text = "This is a test"
            End If
        Next
    End Sub

     

    Steps to reproduce:

    1. Open new Presentation

    2. Goto Insert -> Header Footers and insert a footer with "text" and close the Header Footer window

    3. Then run the above code through the macros

    The actual slide gets updated but not the slides in the overview

    You can also manually reproduce this if you go in step 3(instead of running the macro) to Insert -> Header Footers again and change the text there to "This is a test"

    Can you reproduce this?

    Because your code works, is there any other way to just set the text of the footer directly without enumerating all shapes first.

    Thank you very much

    Mark


    Viele Grüße Mark

    • Edited by Wompi Wednesday, November 9, 2011 7:29 AM
    Wednesday, November 9, 2011 7:24 AM
  • >>The actual slide gets updated but not the slides in the overview

    Wompi, I tested the code, but the result is not the same as you described, if I run the macro, the footers of the sides all get updated immediately on my side.

    Sub ChangeText()
    Dim s As Slide
    Dim shp As Shape
    For Each s In ActivePresentation.Slides
                s.HeadersFooters.Footer.Text = "This is another test"
        Next
    End Sub


    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, November 10, 2011 9:13 AM
  • Hi,

    mhh thats odd. I tried it with German and English versions and 2007 and 2010.

    Can you reproduce the problem without the Macro?:

    1. Open new Presentation (Normal view, visible slides tab in the sidebar)

    2. Go to Insert -> Header & Footer -> Activate the Footer and Insert any short text e.g. "test" and "Apply to all" 

    3. The Footer is visible in the slide and also in the sidebar where the slides and outline tabs are

    4. Open the Header & Footer once again and just change the text to something longer e.g. "This is a very long test text" and click "Apply to all"

    5. Then the footer in the slide gets updated correctly but in my case it is not updated in the sidebar(slides & outline) in the slides tab.

    It only gets updated if the sidebar gets refreshed e.g if I change to another view and back or if I change the size of the sidebar

     

    Thank you very much

    Best regards,

    Mark


    Viele Grüße Mark
    • Edited by Wompi Monday, November 14, 2011 10:06 AM
    Monday, November 14, 2011 10:03 AM
  • Wompi, I finally reproduced your problem. I guess this could be an issue of Powerpoint 2010.

    As for the problem, I think the temporay workarounds is the macro in the first my first reply.

    You can report it to our connect site:

    http://connect.microsoft.com/visualstudio

    You can report it under the visualstudio category and it can be routed to the right team. In your feedback, you can reference this thread and our engineer will take your feedback seriously and evaluate it. Thank you for your valuable feedback in advance.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, November 15, 2011 2:12 PM