Thread: Abandon invoice
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
GregR[_2_] GregR[_2_] is offline
external usenet poster
 
Posts: 6
Default Abandon invoice

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

"K Dales" wrote in message
...
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" wrote:

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