Log in

View Full Version : Different PPT templates reacting different on the same macros



RandomGerman
08-15-2015, 02:11 AM
Hi all,

I opened up a new thread for this, because it seems to be a different problem than the one of the thread where I originally asked for help concerning this.


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 - a footnote ("Footnote") and a section marker ("SectionMarker"). The footnote 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 beahviour of the section marker, which is a group of two objects. One of these appears on the correct position in both of the templates, the other one only in one of it.

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

Macro number four ("ParaSpaceAfterBackToZero") 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. Footnote and section marker produce their error in the template, where the spacing tool works fine, and the spacing tool does strange things in the template where footnote and section marker work well.

I attached both examples, so feel free to test. Any idea will be appreaciated!

Thanks,
RG


P.S.: The margin definitions for the section marker where in German (1,1 instead of 1.1) in the first version, that's why I attached it another time ... unfortunately I wasn't able to delete the old ones. :-(

RandomGerman
08-15-2015, 02:19 AM
I should have mentioned I'm working with 2010.

John Wilson
08-16-2015, 04:32 AM
The problem with line spacing is because some examples have .LineRuleAfter (and Before and Within) set to True and others to False. When False +3 increases by 3 points when True by 3 LINES.

The other problem is probably because in some file snap to other objects is ON and others it is OFF.

RandomGerman
08-16-2015, 06:17 AM
Hi John,

thank you for your time. I added .LineRuleAfter to the code and set it to false, and now it sets paragraphing to 3 points. But this is not what I wanted to achieve. I was trying to create a tool to increase by 3 pt. At the moment the result is always 3 pt, no matter if it was 0 pt, 3 pt or 18 pt before.


Dim Shp As Shape

If ActiveWindow.Selection.Type = ppSelectionNone Then
'(Nothing)
Else
For Each Shp In ActiveWindow.Selection.ShapeRange
With Shp
.TextFrame2.TextRange.ParagraphFormat.LineRuleAfter = msoFalse
.TextFrame2.TextRange.ParagraphFormat.SpaceAfter = .TextFrame2.TextRange.ParagraphFormat.SpaceAfter + 3
End With
Next Shp
End If

For the other problem I'm afraid it is not (or not only) the snap function. I turned it off, set to standard, opened a new file, pasted in the macros ... and still the result is wrong.

14184

RandomGerman
08-16-2015, 12:03 PM
There is a difference in the AutoFit options between both files. After aligning them, the problems with the positions of footnote and section marker did not appear anymore.


LineRuleAfter remains a mystery to me. On the one hand it fixes the issue whether points or lines are counted, but on the other hand it seems to destroy the increasing functionality. By the way, John, did you guess (from your experience) or is there a possibility to look up somewhere in a file, whether LineRule is set to true or false?

John Wilson
08-17-2015, 01:22 AM
I think there's some bad logic in the MSFT code!

Maybe goes like this:

If he is switching to Points (LineRuleAfter=False) then he must know it is now in Lines. Therefore the current value is meaningless so set it to zero and start again!

Try:

With oshp
If .TextFrame2.TextRange.ParagraphFormat.LineRuleAfter = True Then .TextFrame2.TextRange.ParagraphFormat.LineRuleAfter = False
End With

RandomGerman
08-17-2015, 07:50 AM
The first tests say: Excellent! :)