Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to backup Excel using VBA?

I am looking for a "Save As" type functionality without changing the
Excel's current file.

What I am trying to do is to save a snapshot of the current worksheet
in CSV format before my macro's logic begins to execute.
ActiveWorkbook.SaveAs method worked exactly like I wanted, but it
changed the current file in the Excel.

SaveCopyAs method would work fine, but it insists on saving the whole
workbook and also doesn't support changing the format to CSV.

I could read the contents of the worksheet, convert to CSV strings,
open a text file, and write to it. But, if there is a built-in
function, I don't want to reinvent the wheel.

Thank you for your time.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to backup Excel using VBA?

see SaveCopyAs in help.

Regards,
Peter T


wrote in message
...
I am looking for a "Save As" type functionality without changing the
Excel's current file.

What I am trying to do is to save a snapshot of the current worksheet
in CSV format before my macro's logic begins to execute.
ActiveWorkbook.SaveAs method worked exactly like I wanted, but it
changed the current file in the Excel.

SaveCopyAs method would work fine, but it insists on saving the whole
workbook and also doesn't support changing the format to CSV.

I could read the contents of the worksheet, convert to CSV strings,
open a text file, and write to it. But, if there is a built-in
function, I don't want to reinvent the wheel.

Thank you for your time.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to backup Excel using VBA?

On Jan 10, 10:30*am, "Peter T" <peter_t@discussions wrote:
see SaveCopyAs in help.

Regards,
Peter T


Peter, thanks for your message. SaveCopyAs wouldn't save as CSV and
wouldn't let me save just the current worksheet. We are on Excel 2003
version.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to backup Excel using VBA?

wrote in message
see SaveCopyAs in help.


Peter, thanks for your message. SaveCopyAs wouldn't save as CSV
and wouldn't let me save just the current worksheet.


Sorry, I didn't read your post carefully before replying.
How about this -

Sub test()
Dim ws As Worksheet

Set ws = ActiveSheet ' change to suit
ws.Copy

Application.DisplayAlerts = False
' code to ensure filename does not already exist
ActiveWorkbook.SaveAs Filename:="C:\CVS_test.csv", FileFormat:=xlCSV
ActiveWorkbook.Close

Application.DisplayAlerts = true
End Sub


Regards,
Peter T


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to backup Excel using VBA?

Wonderful solution!

Thank you very much for your help.
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
Backup Excel file Hema Excel Discussion (Misc queries) 2 May 28th 10 04:12 PM
Backup Excel customization Vivek[_2_] New Users to Excel 1 September 21st 08 05:22 PM
How to backup excel files? romelsb Excel Programming 17 November 2nd 06 07:42 PM
Excel Backup Location Tony Excel Discussion (Misc queries) 7 March 30th 06 10:47 PM
Backup file for excel NITESH G Excel Discussion (Misc queries) 1 November 10th 05 03:53 PM


All times are GMT +1. The time now is 07:28 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"