Chaning the Excel 2003 Save Path

Posted on 2006-05-03
Last Modified: 2008-01-09
For Word, there is a nice simple vb function called FileSaveChangeDirectory, which resets all the file paths to look wherever you want.

From what I can tell, in Excel ChDir does much the same. However, when I go to File>Save As in the Excel menu, it always defaults back to where the current document is stored (XLSTART for a new document, as that's where the template document is stored). Is there any way to stop this?

Note 1) If I call CurDir in the before save event, it returns the correct directory. When the save dialog gets called, it's reverted back to the saved file location.

Note 2) On File>Open, the dialog opens in the correct directory. Once the save dialog has been called (even when cancelling it), the CurDir reverts back to the saved file location.

Note 3) Yes, I am using ChDrive as well. No, it's not helping.
Question by:SWOne
    LVL 44

    Accepted Solution

    Hello SWOne,

    not sure if this is helping since you do not mention user interaction in saving the file but you could set the path + filename in a box while calling the save

    Dim fileSaveName As Variant
      fileSaveName = Application.GetSaveAsFilename(InitialFileName:="f:\thisismyfolder\data\myFile.csv", fileFilter:="CSV (*.csv), *.txt")
      If fileSaveName = False Then
        Exit Sub
      End If

    hope this helps a bit
    LVL 44

    Expert Comment

    i think my comment does help, BUT it would be good to hear from the asker

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now