Macro to revert changes since save

Viewed 1200

I found an old script online to close the document without saving the changes, then re-open the document:

Sub RevertFile()
  wkname = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
  ActiveWorkbook.Close Savechanges:=False
  Workbooks.Open Filename:=wkname
End Sub

I want this since you can't "undo" changes caused by running a macro. However, it does not seem to work in MS Office v1609. Firstly, the document does not re-open after it is closed. Secondly, the modifications are saved when I want them not to be. How can I rewrite this script to get it to work? Thanks.

[edit]

Here is the other sub-routine I am using.

Sub FixPlatforms()
'PURPOSE: Find & Replace a list of text/values throughout entire workbook
'SOURCE: www.TheSpreadsheetGuru.com/the-code-vault

Dim sht As Worksheet
Dim platList As Variant
Dim x As Long

platList = Array _
( _
    "PS4", "PlayStation 4", _
    "PS3", "PlayStation 3", _
    "PS2", "PlayStation 2", _
    "PSV", "PlayStation Vita", _
    "PSP", "PlayStation Portable", _
    "WIN", "Microsoft Windows", _
    "SNES", "Super Nintendo Entertainment System" _
)


'Loop through each item in Array lists
  For x = 1 To UBound(platList) Step 2
    'Loop through each worksheet in ActiveWorkbook
      For Each sht In ActiveWorkbook.Worksheets
        sht.Cells.Replace What:=platList(x), Replacement:=platList(x - 1), _
          LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
          SearchFormat:=False, ReplaceFormat:=False
      Next sht

  Next x

End Sub

Is there something wrong with it?

1 Answers
Related