Open impcymru-sian-sweet opened 1 year ago
This is technically possible: https://learn.microsoft.com/en-us/office/vba/api/excel.application.onundo
But somewhat nightmare-ish to implement, unless we:
This would be a massive improvement in usability
UNDO has a historical importance. It marks the beginning of the period when computers started be used by people who didn't program them, the arrival of the real user, and the naive user.
The function was first mentioned in the 1976 IBM research report "Behavioral Issues in the Use of Interactive Systems" by Lance A. Miller and John C. Thomas. They outlined the necessity to provide future users with UNDO:
"the benefit to the user in having -- even knowing -- of a capability to withdraw a command could be quite important (e.g, easing the acute distress often experienced by new users, who are worried about 'doing something wrong')"
One simple option might be to - by default? - copy the chart and format the copy. Not as good as integrating Excel's undo, but it's a start.
Sub ImpCymruCopyAndFormatActiveChart()
Dim cht As Chart
Set cht = ActiveChart
If cht Is Nothing Then
' No chart selected
Exit Sub
End If
If TypeOf cht.Parent Is ChartObject Then
Dim chtObj As Object
Set chtObj = cht.Parent.Duplicate
chtObj.Top = chtObj.Top + 5
chtObj.Left = chtObj.Left + 5
Set cht = chtObj.Chart
End If
If TypeOf cht.Parent Is Worksheet Then
End If
ImpCymruFormatChart cht
End Sub
What I did: Created a run chart with any data
What happened: A chart is created and the undo button is disabled
What should've happened: A chart is created with the option to select the undo option. If you are using an existing chart the option to undo the change would be helpful. Work around is to create a copy of any original chart before applying the formatter function