Consulting

Results 1 to 2 of 2

Thread: Decreasing Internal Margins for a shape (PowerPoint)

  1. #1

    Decreasing Internal Margins for a shape (PowerPoint)

    Hi,

    I created the macro which incrementally decreases the internal margins of shapes (by 0.1 cm.).

    I wonder if there is any way to make this code go further and ignore the numbers which are smaller than 0.1 cm.

    For example, if I set all the shape's margins to 0.26 cm I can only click twice and then the error raised “The specified value is out of range”. I would like to ignore the remaining 0.06 cm and set the value to 0 cm after the third click.

    I would be more than grateful for any suggestions how to solve this!

    PHP Code:
    Sub Decrease_01cm_Shape()
       
    With ActiveWindow.Selection.ShapeRange.TextFrame2
        
    .MarginLeft = .MarginLeft 2.8346456693
        
    .MarginRight = .MarginRight 2.8346456693
        
    .MarginBottom = .MarginBottom 2.8346456693
        
    .MarginTop = .MarginTop 2.8346456693
       End With
    End Sub 

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,881
    Location
    Something like this maybe:

    Sub sngDecrease_01cm_Shape()
    
    
        Const sngDec As Single = 2.834645
        With ActiveWindow.Selection.ShapeRange.TextFrame2
            If .MarginLeft - sngDec > 0.1 Then .MarginLeft = .MarginLeft - sngDec
            If .MarginRight - sngDec > 0.1 Then .MarginRight = .MarginRight - sngDec
            If .MarginTop - sngDec > 0.1 Then .MarginTop = .MarginTop - sngDec
            If .MarginBottom - sngDec > 0.1 Then .MarginBottom = .MarginBottom - sngDec
        End With
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Posting Permissions

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