#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default save a copy

In Excel 2003, is it possible to create a
macro that will save a copy of the workbook
in a specific location, allow the user to name
it but keep the original workbook open?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default save a copy

After a little more research, I tried this:

Sub Saveit()

Dim strName As String
Dim sDir As String

sDir = "C:\Temp"
ChDir (sDir)

strName = ActiveWorkbook.Worksheets("Main").Range("G1") & ".xls"

ActiveWorkbook.SaveCopyAs Filename:=strName

End Sub

But it doesn't work....can anyone help me out? Thanks.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default save a copy

On Nov 26, 11:53*am, Opal wrote:
In Excel 2003, is it possible to create a
macro that will save a copy of the workbook
in a specific location, allow the user to name
it but keep the original workbook open?


Here's a macro I created many years ago. You may want to tweak it a
little because I just used it on my own computer. For example, if you
want others to use it you may want to have the macro create the folder
if it doesn't exist.

Sub BackupCurrentWorkbook()
Dim origName As String
Dim cpyFname As String
Dim newName As String
Dim dt As String
dt = Format(Now(), "dd-mmm-yy hh:mm am/pm")
origName = Mid(ActiveWorkbook.Name, 1, Len(ActiveWorkbook.Name) -
4)
cpyFname = InputBox("This will save a backup copy of the current
workbook in the C:\Backup\ folder." & Chr(10) & Chr(10) & "Enter the
filename you wish to use for the backup copy.", "Save Backup Copy",
origName)
If cpyFname = "" Then Exit Sub
dt = Format(Now(), "yymmddhhmm")
newName = "C:\Backup\" & cpyFname & " " & dt & ".xls"
ActiveWorkbook.SaveCopyAs (newName)
On Error GoTo errLine:
Exit Sub
errLine:
MsgBox "Sorry! An error occured and the file could not be backed
up!", vbOKOnly, "Error !"
End Sub

Regards,
Francis Hayes
www.TheExcelAddict.com
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default save a copy

Thank you! Got it what I wanted!!

Dim cpyName As String
Dim newName As String

cpyName = ActiveWorkbook.Worksheets("Main").Range("G1")
newName = "C:\Temp\" & cpyName & ".xls"

ActiveWorkbook.SaveCopyAs (newName)
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
Save a Copy? George W. Barrowcliff Setting up and Configuration of Excel 2 July 12th 07 01:03 AM
Save a copy? George W. Barrowcliff Excel Worksheet Functions 0 March 12th 07 12:00 AM
want to save a copy as text , not save the original as text Janis Excel Programming 4 December 1st 06 05:40 AM
Save column J only using copy/paste & temporary copy mikeburg[_85_] Excel Programming 2 June 7th 06 05:37 PM
How to save a file without overwrite or save a copy? SettingChange Setting up and Configuration of Excel 1 November 3rd 05 02:10 AM


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