VBA created shapes sometimes break ranks

Discussion in 'Microsoft Powerpoint' started by KitingJoe, Apr 24, 2009.

  1. KitingJoe

    KitingJoe Guest

    Hi,
    approx. every fifth time I run the code below one shape break ranks:
    Jumping a bit to the left or right or is AutoSized, so that is smaller.

    What's the matter???

    Thanks.
    Joe

    Sub Example()

    Dim dblLeft As Double
    Dim dblTop As Double
    Dim dblLeftCurrent As Double
    Dim dblWidth As Double
    Dim dblHeight As Double
    Dim dblA As Double

    dblLeft = 60
    dblTop = 200
    dblLeftCurrent = dblLeft
    dblWidth = 10
    dblHeight = 10

    For dblA = 1 To 15

    ActiveWindow.Selection.SlideRange.Shapes.AddTextbox(msoTextOrientationHorizontal, dblLeftCurrent, dblTop, _
    dblWidth,
    dblHeight).Select
    With ActiveWindow.Selection.TextRange
    .Text = "X"
    With .Font
    .Name = "Arial"
    .Size = 6
    .Bold = msoFalse
    .Italic = msoFalse
    .Underline = msoFalse
    .Shadow = msoFalse
    .Emboss = msoFalse
    .BaselineOffset = 0
    .AutoRotateNumbers = msoFalse
    End With
    End With
    With ActiveWindow.Selection.ShapeRange
    .Fill.Transparency = 0#
    .Line.Weight = 0.25
    .Line.Visible = msoTrue
    .Line.BackColor.RGB = RGB(255, 255, 255)
    .Line.Style = msoLineThinThin
    .TextFrame.MarginLeft = 1
    .TextFrame.MarginRight = 1
    .TextFrame.MarginTop = 1
    .TextFrame.MarginBottom = 1
    DoEvents
    With .TextFrame
    .HorizontalAnchor = msoAnchorCenter
    .VerticalAnchor = msoAnchorMiddle
    .WordWrap = msoFalse
    .AutoSize = ppAutoSizeNone
    End With
    End With
    ActiveWindow.Selection.Unselect
    dblLeftCurrent = dblLeftCurrent + dblWidth
    Next
    End Sub
     
    KitingJoe, Apr 24, 2009
    #1
    1. Advertisements

  2. KitingJoe

    KitingJoe Guest

    PowerPoint 2003
     
    KitingJoe, Apr 24, 2009
    #2
    1. Advertisements

  3. KitingJoe

    KitingJoe Guest

    Hi Steve,

    I found exactly the same "solution" and deleted it from the example, not to
    confuse anybody. Anymore I thought: "give PPT time to do the necessary
    things" and inserted a DoEvents. But this makes the problem worse.

    Funny enough my "configuration" now is in a mode, that no defect is annoying
    me. But nothing intentional changed!?!

    Hope that will last but it's a nasty thing for developers.

    Ahoi, Joe
     
    KitingJoe, Apr 27, 2009
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    7
    Views:
    289
    Guest
    Feb 22, 2006
  2. Replies:
    3
    Views:
    274
    Brian Reilly, MVP
    Aug 7, 2006
  3. Replies:
    2
    Views:
    615
    David M. Marcovitz
    Aug 16, 2006
  4. Guest
    Replies:
    1
    Views:
    150
    Steve Rindsberg
    Apr 10, 2007
  5. Guest

    Adding customized shapes to shapes toolbar

    Guest, Jul 23, 2007, in forum: Microsoft Powerpoint
    Replies:
    2
    Views:
    252
    Guest
    Jul 24, 2007
Loading...

Share This Page