Consulting

Results 1 to 4 of 4

Thread: PowerPoint .pptm vs. ppam tool

  1. #1
    VBAX Contributor
    Joined
    Dec 2018
    Location
    South London
    Posts
    115
    Location

    PowerPoint .pptm vs. ppam tool

    error-heading.jpgHi John

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

    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
    Attached Images Attached Images
    Last edited by RayKay; 01-17-2019 at 09:34 AM. Reason: Added an image

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    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
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Contributor
    Joined
    Dec 2018
    Location
    South London
    Posts
    115
    Location
    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).

    error-heading.jpg

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

    Thank you.

  4. #4
    VBAX Regular
    Joined
    Dec 2018
    Posts
    24
    Location

    Separate code group

    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
    ...
    Last edited by StarPig; 01-17-2019 at 01:08 PM. Reason: Code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •