View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
dmthornton dmthornton is offline
external usenet poster
 
Posts: 19
Default Saving a single worksheet as new file before close

You could add something like this in the Workbook Close event:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
Sheet3.Copy
ActiveWorkbook.Close True, ThisWorkbook.Path & "\Export_" & Format(Now,
"YYYYMMDDHHMMSS")
Application.ScreenUpdating = True
End Sub

This should create a copy of the worksheet in the working folder. The name
includes a date/time stamp as well.



"MDC" wrote:


I am trying to get my workbook to export or save a single worksheet as a
new file each time the main workbook closes . . . is this possible? I
am trying to date and time stamp each newly created file as well so I
can have a history of changes made on that one sheet . . . the reason I
am doing this is because the workshhet is updated weekly and I would
like to keep the past data on record instead of it being deleted each
time someone types in a cell . . . I'm sure there is some simple code
to do this that I am not understanding . . . thanks in advance for any
help on this matter.


--
MDC
------------------------------------------------------------------------
MDC's Profile: http://www.excelforum.com/member.php...o&userid=34391
View this thread: http://www.excelforum.com/showthread...hreadid=541710