Undo/Redo changes shape cell section

F

faraz

i have implemented simple undo/redo given by visio control.

here what i do

i drag a shape to the drawing, as soon as it shape is dropped, i add a
section in shape and save some string

now i undo it. it clears the shape from the drawing.

then i redo , it adds the shape onto the drawing but there is no
section in the shape. !



can you guys tell me why it doesnt save the cell in the shape when
redoing?
 
J

JuneTheSecond

Same things happened when i tryed munualy on Visio drawing window.
Section could be recovered only when the same shape window was
kept on the window.
When once delete the shapesheet, redo operation caused error,
even if i opened a new shape sheet window for the shape.
And so, I thought redu process in program could hardly recover the section
once lost.
 
J

JuneTheSecond

But redo operation restored the section,
when i made an action section in next VBA macro.
Here, all process had to be surrounded by
BeginUndoScope and EndUndoScope.

Sub Macro2()
Dim UndoScopeID1 As Long
UndoScopeID1 = Application.BeginUndoScope("UndoRedoTest")

Application.Windows.ItemEx("UndoRedoTest.vsd").Activate
Application.ActiveWindow.Page.Drop
Application.Documents.Item("C:\Documents and Settings\yoda\My
Documents\UndoRedoTest.vsd").Masters.ItemU("Master.0"), 3.543307, 8.267717

Application.ActiveWindow.Page.Shapes.ItemFromID(1).OpenSheetWindow

Application.ActiveWindow.Shape.AddSection visSectionAction
Application.ActiveWindow.Shape.AddRow visSectionAction, visRowLast,
visTagDefault
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionMenu).FormulaU = """"""
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionPrompt).FormulaU = """"""
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionHelp).FormulaU = """"""
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionAction).FormulaU = """"""
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionChecked).FormulaU = "0"
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionDisabled).FormulaU = "0"
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionReadOnly).FormulaU = "FALSE"
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionInvisible).FormulaU = "FALSE"
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionBeginGroup).FormulaU = "FALSE"
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionTagName).FormulaU = """"""
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionButtonFace).FormulaU = """"""
Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionSortKey).FormulaU = """"""

Application.ActiveWindow.Shape.CellsSRC(visSectionAction, 0,
visActionMenu).FormulaU = """test"""

Application.ActiveWindow.Close

Application.EndUndoScope UndoScopeID1, True
End Sub
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top