View Single Post
  #2  
Old 28-02-2013, 08:19
FaneDuru FaneDuru is offline
Member
 
Join Date: May 2012
Posts: 35
Unhappy

In the meantime I did the next tests:
This simple code can be UNDO with shape selection:
Code:
Sub testSelForUNDO()
   Dim S As Shape
   ActiveDocument.BeginCommandGroup "CreareRect"
    Set S = ActivePage.ActiveLayer.CreateRectangle(50, 200, 22, 20)
    'ActiveDocument.AddPages (1)
   ActiveDocument.EndCommandGroup
   ActiveWindow.Refresh
End Sub
Sub UndoWithSelection()
   ActiveDocument.Undo
   ActivePage.Shapes.FindShape("xxx").CreateSelection
End Sub
With the line adding a new page (commented now), it does not select the shape any more...
I also mention that the shape in discussion is part of a group but I do not think that can be a problem. FindShape works inside groups, too...

I also mention that this is not an issue which I really need but I would like to understand what happens and how it can be solved...
I can see that the shape (xxx) looks selected in Object Manager. If in 'UndoWithSelection' procedure I insert a line:
Code:
 Debug.Print ActiveShape.BottomY
it returns the real bootomY of the shape like selection exists...
If I put this line in another procedure and run it returns an error message (Object variable or With block variable not set), like anything is selected.
I tried ActiveWindow.Refresh, but without result.

What else should I try?

Last edited by FaneDuru; 01-03-2013 at 04:59. Reason: adding some text...
Reply With Quote