Abandon invoice

  • Thread starter Thread starter Pat
  • Start date Start date
P

Pat

I want to have the ability to abandon an invoice and return it to its former
state. I thought if I closed the workbook without saving it and then reopen
it this would do the trick. I ran the following code but the workbook did
not open.

Application.DisplayAlerts = False
ActiveWorkbook.Close
Workbooks.Open Filename:=" "
Application.DisplayAlerts = True


Apart from just simply manually closing/reopening the workbook has anyone
got another method I should consider?

Ta
 
The Open method requires a filename parameter, and by specifying "" you are
not giving it a file to open. Application.RecentFiles(1).Open should open
the last workbook used. But this seems to me to be an awkward method of
"undoing" changes. If possible, I would create a copy of the invoice (before
changes), hide it, and then have a routine that restores it.
 
Pat try this routine:

Sub RevertFile()

wkname = ActiveWorkbook.path & "\" & ActiveWorkbook.Name
ActiveWorkbook.Close savechanges:=False

Workbooks.Open FileName:=wkname

End Sub

It will revert the file to the last saved change.

Greg
 

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

Back
Top