Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to save another (differently named) version of my file whenever
I save. It works fine if I use the normal save, but if the save is triggered from the Before_Close event, it just skips over the following line... ThisWorkbook.SaveAs Filename:=CurrPath & "\" & CurrName in debug, it finds the line (it goes yellow), it doesn't generate any errors, but it steps through the line without doing any saving The CurrPath and CurrName variables do contain valid text Why is it not saving? thanks M |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try
Private Sub Workbook_BeforeClose(Cancel As Boolean) Cancel = True ThisWorkbook.SaveAs Filename:=CurrPath & "\" & CurrName End Sub -- Jacob (MVP - Excel) "Michelle" wrote: I am trying to save another (differently named) version of my file whenever I save. It works fine if I use the normal save, but if the save is triggered from the Before_Close event, it just skips over the following line... ThisWorkbook.SaveAs Filename:=CurrPath & "\" & CurrName in debug, it finds the line (it goes yellow), it doesn't generate any errors, but it steps through the line without doing any saving The CurrPath and CurrName variables do contain valid text Why is it not saving? thanks M |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oops...Disable the events and then save as..
Application.EnableEvents = False ThisWorkbook.SaveAs Filename:=CurrPath & "\" & CurrName Application.EnableEvents = True -- Jacob (MVP - Excel) "Jacob Skaria" wrote: Try Private Sub Workbook_BeforeClose(Cancel As Boolean) Cancel = True ThisWorkbook.SaveAs Filename:=CurrPath & "\" & CurrName End Sub -- Jacob (MVP - Excel) "Michelle" wrote: I am trying to save another (differently named) version of my file whenever I save. It works fine if I use the normal save, but if the save is triggered from the Before_Close event, it just skips over the following line... ThisWorkbook.SaveAs Filename:=CurrPath & "\" & CurrName in debug, it finds the line (it goes yellow), it doesn't generate any errors, but it steps through the line without doing any saving The CurrPath and CurrName variables do contain valid text Why is it not saving? thanks M |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Take a look at VBA's help for .SaveCopyAs
It sounds like that may be more appropriate for you. Michelle wrote: I am trying to save another (differently named) version of my file whenever I save. It works fine if I use the normal save, but if the save is triggered from the Before_Close event, it just skips over the following line... ThisWorkbook.SaveAs Filename:=CurrPath & "\" & CurrName in debug, it finds the line (it goes yellow), it doesn't generate any errors, but it steps through the line without doing any saving The CurrPath and CurrName variables do contain valid text Why is it not saving? thanks M -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Saving Excel 2007 file in 2003 creates very large file | Excel Discussion (Misc queries) | |||
Saving multi-tab excel file created from comma delimited text file | Excel Programming | |||
How do I stop Excel 2000 from saving file history from file that . | Excel Discussion (Misc queries) | |||
saving an excel file as an ASCII text file without delimiters | Excel Programming | |||
Saving a file(new) using the multiple cell contents as a file name | Excel Programming |