![]() |
Save new file in same directory
In a workbook I create a backup.xls file. I want that file standard to be
saved in the same directory where the main file is located. How can do that in a macro? |
Save new file in same directory
Assuming you are doing a "Save As" on the ActiveWorkbook...
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "Backup.xls" -- Charles Chickering "A good example is twice the value of good advice." "Gert-Jan" wrote: In a workbook I create a backup.xls file. I want that file standard to be saved in the same directory where the main file is located. How can do that in a macro? |
Save new file in same directory
You need a path separator character in there.
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & _ Application.PathSeparator & "Backup.xls" For backups, it is better to use SaveCopyAs rather than SaveAs. -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "Charles Chickering" wrote in message ... Assuming you are doing a "Save As" on the ActiveWorkbook... ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "Backup.xls" -- Charles Chickering "A good example is twice the value of good advice." "Gert-Jan" wrote: In a workbook I create a backup.xls file. I want that file standard to be saved in the same directory where the main file is located. How can do that in a macro? |
All times are GMT +1. The time now is 08:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com