Creating a custom Undo solution? 
Author Message
 Creating a custom Undo solution?

Hi,

I am trying to create an undo feature for my macros. Each macro now has
several dozens of actions that I would like to see undone when I click
either the standard undo button or a custom undo button.  I have had limited
success with the undo x and undoAction where I manually apply a value to a
variable and then use it in an object.undo var statement.

Is there a better way of doing an undo function?

Is there a way to access the names of actions directly from the redo
dropdown box?

Can I access the standard undo/redo list and program from them or should I
create a custom approach? If so, how do I do this?

Thank you for your help,

Paul



Wed, 11 Aug 2004 07:43:40 GMT  
 Creating a custom Undo solution?
Project doesn't have an undo/redo list for more than the last action - even
then somethings can not be undone.

Sometimes you can store previous values so that they can be restored later,
but this will require careful consideration if you want to have multiple
levels of undo.

Obviously it is a difficult problem or project would offer this function
(and it still doesn't!)

For a simple example of a macro which restores previous values look at the
one titled "Remove Contraints" at

http://masamiki.com/project

--
Please try to keep replies in this group. I do check e-mail, but only
infrequently.
For Macros and other things check http://masamiki.com/project

-Jack Dahlgren, Project MVP

+++++++++++++++++++

Quote:
> Hi,

> I am trying to create an undo feature for my macros. Each macro now has
> several dozens of actions that I would like to see undone when I click
> either the standard undo button or a custom undo button.  I have had
limited
> success with the undo x and undoAction where I manually apply a value to a
> variable and then use it in an object.undo var statement.

> Is there a better way of doing an undo function?

> Is there a way to access the names of actions directly from the redo
> dropdown box?

> Can I access the standard undo/redo list and program from them or should I
> create a custom approach? If so, how do I do this?

> Thank you for your help,

> Paul



Wed, 11 Aug 2004 05:25:41 GMT  
 Creating a custom Undo solution?
I have a macro that calculates plan forecast for a project.  In order to do
that i right the calculated plan forecast % into the percent complete
column.  Before I do that however, I write the current value from percent
complete column to text16 column.  Then I have an undo key that takes the
values from the text16 column and writes them back to the percent complete
column.  It works fine as long as they only run the plan macro once. Code
excerpts below.

Hope it helps,

Brad

Sub Planned_Percent_Complete()
    On Error GoTo ErrorHandler
    'Get the reporting date.
    Dim rptdate As Date
    rptdate = InputBox("This will overwrite the current values in the %
Complete field and in Text16.  Save copy before running. " _
        & Chr(13) & "Report date for planned forecast calculation?" &
Chr(13) & "(mm/dd/yy)", "Plan Forecast")
    'Loop through each task in the project

    For Each ATask In ActiveProject.tasks
        PlPctComp = 0
        'skip blank rows
        If Not ATask Is Nothing Then
            ATask.Text16 = "" 'set text 16 to null
            'skip summary tasks
                    ...PlPctComp calculation code....
                'write actual % complete to Text15 field
                ATask.Text16 = ATask.PercentComplete & "%"
                'write planned % complete to percent complete field
                ATask.PercentComplete = PlPctComp
            End If
        End If
    Next ATask
    .....error handler etc.....
End Sub

Sub Undo_Planned_Forecast()
    On Error GoTo ErrorHandler

    For Each ATask In ActiveProject.tasks
        'skip blank rows
        If Not ATask Is Nothing Then
            'skip summary tasks
            If ATask.Summary = No Then
                If IsNull(Text16) = False Then
                    ATask.PercentComplete = ATask.Text16
                End If
            End If
        End If
    Next ATask
    MsgBox "Plan Forecast has been undone.", vbOKOnly, "Undo Plan Forecast"
Exit Sub        ' Exit to avoid handler.
ErrorHandler:   ' Error-handling routine.
        MsgBox "Undo Planned Forecast failed please contact management",
vbOKOnly
End Sub


Quote:
> Project doesn't have an undo/redo list for more than the last action -
even
> then somethings can not be undone.

> Sometimes you can store previous values so that they can be restored
later,
> but this will require careful consideration if you want to have multiple
> levels of undo.

> Obviously it is a difficult problem or project would offer this function
> (and it still doesn't!)

> For a simple example of a macro which restores previous values look at the
> one titled "Remove Contraints" at

> http://masamiki.com/project

> --
> Please try to keep replies in this group. I do check e-mail, but only
> infrequently.
> For Macros and other things check http://masamiki.com/project

> -Jack Dahlgren, Project MVP

> +++++++++++++++++++


> > Hi,

> > I am trying to create an undo feature for my macros. Each macro now has
> > several dozens of actions that I would like to see undone when I click
> > either the standard undo button or a custom undo button.  I have had
> limited
> > success with the undo x and undoAction where I manually apply a value to
a
> > variable and then use it in an object.undo var statement.

> > Is there a better way of doing an undo function?

> > Is there a way to access the names of actions directly from the redo
> > dropdown box?

> > Can I access the standard undo/redo list and program from them or should
I
> > create a custom approach? If so, how do I do this?

> > Thank you for your help,

> > Paul



Sun, 15 Aug 2004 05:15:38 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. a solution to growing mdb's and how to undo a form with sub-form

2. create custom icon,custom combobox in custom toolbar

3. create custom icon,custom combobox(to insert values)in custom toolbar

4. Can't add Undo to Custom Menu

5. Custom undo-function

6. How to Create Custom Wizard (something like c++ Custom Wizard) In VB.Net

7. Creating custom methods for a custom control

8. custom windows in my Visio solution

9. Custom solution conflicts with ShapeNumbering

10. custom control is not available in other solutions

11. Custom Retail Kiosk hardware & Software Solution

12. Selective Undo from the Undo List

 

 
Powered by phpBB® Forum Software