Search code examples
vbapowerpointpowerpoint-2010

Different PPT templates reacting different on the same macros


I'm new here, so I might have not seen a possibility to upload my problem files, which would make it easier to describe the problem. Edit: The files a here: https://drive.google.com/file/d/0B--IbmtX58h8TnVrdlRyUXZ5a2dEOVJBQkplVjFuVEVMVXhJ/view?usp=docslist_api and: https://drive.google.com/file/d/0B--IbmtX58h8TFR6d3FkWlZpSGFVUGF5bHVhRTR5ZTlnbXAw/view?usp=docslist_api (Thank you for the idea, Steve)

What it is about: I have two documents with different master templates reacting completely different on the same set of macros and I have no idea how and why this can happen and how to repair or avoid it.

Two of the macros just create objects - one is a single textbox, the other one a group of a rectangle and a textbox . The first mentioned appears on the position defined in the code in one of the templates, but a bit below it in the other one. Even more strange is the behavior of the group. The rectangle appears on the correct position in both of the templates, the textbox only in one of it.

Next is a macro for increasing the paragraphing between text lines by 3 pt. It works fine in one template, but in the other template it increases the spacing by 43.2 pt!

Macro number four is made to set back the paragraphing space after back to 0. This one works fine in both templates.

Funny enough, the mistakes appear in opposite to each other. The single textbox and the group produce their error in the template, where the spacing tool works fine, and the spacing tool does strange things in the template where the single textbox and the group work well.

Any idea will be appreciated!

Thanks, RG

I work with PowerPoint 2010.


Solution

  • Your footnote is getting misplaced because the default text settings in one presentation are different from those in the other; in this case the auto fit setting.

    ' in this section of your FOOTNOTE routine:
    With .TextFrame
        ' Add this next line and it will work as expected
        .AutoSize = ppAutoSizeNone
        .TextRange.Text = "Note: " & vbCrLf & "Source: "
        .VerticalAnchor = msoAnchorBottom
    

    Likewise, in your SectionMarker subroutine:

    With .TextFrame
         ' add this
        .AutoSize = ppAutoSizeNone
        ' then the rest of your code
    

    Then it all works as you'd expect. Or at least, it works the same with both templates.