![]() |
Abandon invoice
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 |
Abandon invoice
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 |
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 |
All times are GMT +1. The time now is 10:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com