Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Save file to same directory folder | Excel Discussion (Misc queries) | |||
file save error: the file or directory cannot be created | Excel Discussion (Misc queries) | |||
Automatically save a file in another directory | Excel Discussion (Misc queries) | |||
Save File to Another Directory, but not change Users File Save location | Excel Programming | |||
get path - save new file - same sub-directory as existing file | Excel Programming |