PDA

View Full Version : [SOLVED:] PowerPoint .pptm vs. ppam tool



RayKay
01-17-2019, 07:57 AM
23578Hi John

Just testing lovely buttons you helped with, and I have one weird outcome on a heading that's underlined (code I adapted :think:).

With the *.pptm file open it works fine on its ribbon

When the *.ppam is installed, the tool fails, re image attached.

My code is:

Sub RedHeading()
Set B = ActiveWindow.View.Slide.Shapes.AddTextbox(msoTextOrientationHorizontal, 45.5, 98.9, 725, 400)
With B.TextFrame2
.MarginTop = 0
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.VerticalAnchor = msoAnchorBottom
With .TextRange
.Text = "Heading Text"
With .Font
.Name = "Arial"
.Size = "12"
.Bold = True
.Fill.ForeColor.RGB = RGB(219, 0, 17)
End With
End With
Set myDocument = ActivePresentation.Slides(1)
With myDocument.Shapes.AddLine(45.5, 127, 770, 127).Line
.ForeColor.RGB = RGB(219, 0, 17)
.Weight = 1
End With
End With
End Sub

Function cm2Points(inVal As Single)
cm2Points = inVal * 28.346
End Function



Thank you in advance :)

John Wilson
01-17-2019, 08:49 AM
You haven't specified the alignment which may not help if the default textbox is center aligned. Not declaring variables is a bad habit BTW

Tell it to align left in the code.

With .TextRange
.Text = "Heading Text"
.ParagraphFormat.Alignment=msoAlignLeft

RayKay
01-17-2019, 09:33 AM
Hi John

Thanks, it aligns left when the .ppam is installed, but with the .ppam the line doesn't appear, and it's 'too high up' (re image attached).
If I don't install the ribbon and open the .pptm file, it works fine (re new image attached).

23576

Any ideas please? This is my last button, yay!

Thank you.

StarPig
01-17-2019, 01:07 PM
The code needs to bet Set with the next, ie. C

Set myDocument = ActivePresentation.Slides(1)
Set C = ActiveWindow.View.Slide.Shapes.AddLine(45.5, 127, 770, 127).Line
With C
...