Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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
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 file to same directory folder RobN[_2_] Excel Discussion (Misc queries) 2 April 4th 10 08:06 AM
file save error: the file or directory cannot be created dublg Excel Discussion (Misc queries) 1 September 25th 06 07:07 PM
Automatically save a file in another directory MarkT Excel Discussion (Misc queries) 4 September 18th 06 02:53 PM
Save File to Another Directory, but not change Users File Save location Mike Knight Excel Programming 1 May 28th 04 09:06 PM
get path - save new file - same sub-directory as existing file tegger Excel Programming 2 October 21st 03 10:45 AM


All times are GMT +1. The time now is 07:08 PM.

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

About Us

"It's about Microsoft Excel"