S
srqr
I need to set the z-order of a shape programatically and was planning
to do so using the BringForward and SendBackward methods of the Shape
object. However I found tha after the first invocation of this method
subsequenct invocations do not change the z-order. For example if you
have three or more shapes on a page select the most backward (lowest
z-order) then run the following code the selected shape will only be
brought forward one place.
Sub Main()
Dim shpShape As Shape
Dim I As Integer
For I = 1 To ActivePage.Shapes.Count
Debug.Print I, ActivePage.Shapes(I).Name,
ActivePage.Shapes(I).Index
Next
Set shpShape = ActiveWindow.Selection(1)
shpShape.BringForward
shpShape.BringForward
Debug.Print ""
For I = 1 To ActivePage.Shapes.Count
Debug.Print I, ActivePage.Shapes(I).Name,
ActivePage.Shapes(I).Index
Next
End Sub
Does anyone know why this is? Is there a workaround? I've tried
applying the command to a selection or using the Application.DoCmd with
the same results.
to do so using the BringForward and SendBackward methods of the Shape
object. However I found tha after the first invocation of this method
subsequenct invocations do not change the z-order. For example if you
have three or more shapes on a page select the most backward (lowest
z-order) then run the following code the selected shape will only be
brought forward one place.
Sub Main()
Dim shpShape As Shape
Dim I As Integer
For I = 1 To ActivePage.Shapes.Count
Debug.Print I, ActivePage.Shapes(I).Name,
ActivePage.Shapes(I).Index
Next
Set shpShape = ActiveWindow.Selection(1)
shpShape.BringForward
shpShape.BringForward
Debug.Print ""
For I = 1 To ActivePage.Shapes.Count
Debug.Print I, ActivePage.Shapes(I).Name,
ActivePage.Shapes(I).Index
Next
End Sub
Does anyone know why this is? Is there a workaround? I've tried
applying the command to a selection or using the Application.DoCmd with
the same results.