2013-03-25 1 views
0

파워 포인트 2010루프에서 각 도형을 어떻게 선택합니까?

루프의 각 새로운 도형을 선택하려고합니다. 그러나 루프의 모든 모양이 선택되는 것은 아닙니다. 항상 마지막 모양 만 선택됩니다. 뭐가 잘못 되었 니?

감사합니다

Private Sub AddShapeRectangleOnSelectedText() 

    Dim oText As TextRange 
    Dim linesCount As Integer 
    Dim myDocument As Slide 
    Dim i As Integer 
    Dim s As Shape 

    ' Get an object reference to the selected text range. 
    Set oText = ActiveWindow.Selection.TextRange 
    Set myDocument = ActiveWindow.View.Slide 
    linesCount = oText.Lines.Count 

    For i = 1 To linesCount 
    Set s = myDocument.Shapes.AddShape(msoShapeRectangle, _ 
    oText.Lines(i).BoundLeft, oText.Lines(i).BoundTop, oText.Lines(i).BoundWidth, oText.Lines(i).BoundHeight) 

    With s 
    .Select 
    .Fill.Visible = msoTrue 
    .Fill.Solid 
    .Fill.ForeColor.RGB = RGB(255, 255, 153) 
    .Fill.Transparency = 0.7 
    .Line.Visible = msoFalse 
    .Line.Transparency = 0# 
    End With 
    Next 

최종 하위

답변

0

Select는이 같은 코드를 수정할 수 있습니다

선택이 이전 선택 여부를 대체할지 여부를 나타내는 선택적 매개 변수를 가지고 있습니다 ...

.Select IIf(i = 1, True, False) 
+0

감사합니다. 도움이된다. – Argonist

관련 문제