Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Use Current directory to store file

In an earlier post I found a save as date macro:
(Thanks to Bob Phillips)

Sub SaveWithDate()
ActiveWorkbook.SaveAs Format(Date, "dd-mmm-yy")
End Sub

I also have

Sub SaveAs_Range()
ActiveWorkbook.SaveAs Filename:=Range("A1")
End Sub

Unfortunately they both default to saving in the user
default file location, Tools Options General setting.
Which for convenience may have been set to "My Documents",
with users navigating within.

Rather than from whence they came. c:\wherever\ might
even be d:\my documents\operator1\here ever\

I don't want to create a directory on the user machine, or
know that it already exists.

How do I get the macro to default to the source directory.

It is unlikely other files would be open at the same time,
polluting the "save as" path, but not impossible.
The file will be circulated allowing users to store in
their normal location. Following data entry, at end of
week an update will be stored in the same folder, both
macros give a new filename knowing the old file will not
be overwritten.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Use Current directory to store file

If the file is saved ones you can use this

ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & Format(Date, "dd-mmm-yy")


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Paul Moles" wrote in message ...
In an earlier post I found a save as date macro:
(Thanks to Bob Phillips)

Sub SaveWithDate()
ActiveWorkbook.SaveAs Format(Date, "dd-mmm-yy")
End Sub

I also have

Sub SaveAs_Range()
ActiveWorkbook.SaveAs Filename:=Range("A1")
End Sub

Unfortunately they both default to saving in the user
default file location, Tools Options General setting.
Which for convenience may have been set to "My Documents",
with users navigating within.

Rather than from whence they came. c:\wherever\ might
even be d:\my documents\operator1\here ever\

I don't want to create a directory on the user machine, or
know that it already exists.

How do I get the macro to default to the source directory.

It is unlikely other files would be open at the same time,
polluting the "save as" path, but not impossible.
The file will be circulated allowing users to store in
their normal location. Following data entry, at end of
week an update will be stored in the same folder, both
macros give a new filename knowing the old file will not
be overwritten.



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
open file in current directory Tomo Excel Worksheet Functions 1 January 12th 08 12:04 AM
open file in current directory Tomo Excel Discussion (Misc queries) 1 January 11th 08 11:48 PM
Current Directory Mallasch Excel Discussion (Misc queries) 4 September 15th 06 03:05 AM
HOW TO STORE CURRENT COLUMN & ROW tootles Excel Programming 1 October 2nd 03 10:37 PM
OPENING A FILE LOCATED IN A DIRECTORY DIFFERENT FROM CURRENT DIRECTORS Steven R. Berke Excel Programming 1 July 25th 03 04:49 PM


All times are GMT +1. The time now is 07:00 AM.

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"