Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old January 16th 08, 12:09 PM posted to microsoft.public.excel.setup
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2008
Posts: 5
Default How to write VBA code to make backup copy in another folder when s

I have created a shared bank book namely HSBC in J drive and when I save this
file, I would like to make a backup copy in C drive namely 'Backup HSBC', but
I don't know exactly how to write VBA code.

Should I use the macro function or the Visual Basic Editor under Tools??
Please teach me how to write the macro or VBA code!!

I've tried the following but won't work:

Sub HSBC (ByValSaveASUI As Boolean, Cancel As Boolean)
Application.DisplayAlerts = False
ActiveWorkbook.SaveCopyAs "C:\Backup HSBC.xls" & ActiveWorkbook.Name
ActiveWorkbook.Save
Application.DisplayAlerts = True
End Sub

What have I done wrong?? please advice!!

  #2   Report Post  
Old January 16th 08, 01:43 PM posted to microsoft.public.excel.setup
CLR CLR is offline
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 1,998
Default How to write VBA code to make backup copy in another folder when s

Try using the Tools Macros RecordNewMacro feature and go through all the
steps manually to save the file where you want. This will create a macro for
you. Post back if you run in to problems.

Vaya con Dios,
Chuck, CABGx3



"MCC Wong" wrote:

I have created a shared bank book namely HSBC in J drive and when I save this
file, I would like to make a backup copy in C drive namely 'Backup HSBC', but
I don't know exactly how to write VBA code.

Should I use the macro function or the Visual Basic Editor under Tools??
Please teach me how to write the macro or VBA code!!

I've tried the following but won't work:

Sub HSBC (ByValSaveASUI As Boolean, Cancel As Boolean)
Application.DisplayAlerts = False
ActiveWorkbook.SaveCopyAs "C:\Backup HSBC.xls" & ActiveWorkbook.Name
ActiveWorkbook.Save
Application.DisplayAlerts = True
End Sub

What have I done wrong?? please advice!!



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
can I create backup file in separate folder from the original? MCC Wong Setting up and Configuration of Excel 9 January 19th 08 01:06 AM
save a backup copy in different folder GT Excel Discussion (Misc queries) 3 May 11th 06 07:36 PM
Need code to save file to new folder, erase from old folder Ron M. Excel Discussion (Misc queries) 1 February 24th 06 06:02 PM
How do I Create backup of excel file in other folder khalid Excel Discussion (Misc queries) 1 May 24th 05 11:01 AM
How do i save backup copy in a different folder mekraj Excel Discussion (Misc queries) 3 December 17th 04 08:33 PM


All times are GMT +1. The time now is 11:53 AM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017