Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default File not saving

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default File not saving

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default File not saving

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default File not saving

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving Excel 2007 file in 2003 creates very large file Jon Pearce Excel Discussion (Misc queries) 2 July 16th 09 07:20 PM
Saving multi-tab excel file created from comma delimited text file Marcus Aurelius Excel Programming 2 December 19th 05 05:16 PM
How do I stop Excel 2000 from saving file history from file that . Cathy Excel Discussion (Misc queries) 0 March 29th 05 03:27 PM
saving an excel file as an ASCII text file without delimiters Sewellst Excel Programming 4 January 7th 05 01:41 PM
Saving a file(new) using the multiple cell contents as a file name Dave Peterson[_3_] Excel Programming 1 August 1st 03 01:40 PM


All times are GMT +1. The time now is 04:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"