Setting default File Location

Johnny C

Well-known Member
Joined
Nov 7, 2006
Messages
1,069
Office Version
  1. 365
Platform
  1. Windows
I just moved from XL2000 to XL2003.

It's an installation on the C drive with some elements downloaded from a network each time it starts. One of the things it resets each time it starts is the default file location (I:\Documents\Excel).

I don't want it to start in that location, I want to start in a subfolder on the G: drive. So I put the following macro into the ThisWorkbook page in personal.xls:

Code:
Option Explicit
Private Sub Workbook_Open()
    application.OnKey "{f1}", ""
    With application
        .StandardFont = "Arial"
        .StandardFontSize = "12"
        .AltStartupPath = "I:\Office\Excel\xlstart"
[B]          .DefaultFilePath = "G:\ECM"
[/B]        .EnableSound = True
        .RollZoom = False
    End With
End Sub


When I launch XL2003, I look in Tools>Options>General tab and the Alt Startup and Default file Path are set correctly

Default File Location: G:\ECM
At Startup, open all files in: I:\Office\Excel\xlstart

I know the Alt Startup is working as it replaces the standard toolbar that the network version imposes with a customised one, and my own personal.xls is loaded too.

But when I go to open a file, it's pointing at the location that the network default points to, I:\Documents\Excel

What's going on? Why won't it use the Default File Location?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
To change the path in the File Open and Save dialogs:

Code:
Sub Test()
    ChDrive "C"
    ChDir "C:\TEMP"
End Sub
 
Upvote 0
Works fine, thanks Andrew.

I'm puzzled though why the default option doesn't work, it's set in the Tools>Options>General tab, if I go in, select G:\ECM in the Default File Location box and just hit return (i.e. not change anything), it works.
 
Upvote 0
Works fine, thanks Andrew.

I'm puzzled though why the default option doesn't work, it's set in the Tools>Options>General tab, if I go in, select G:\ECM in the Default File Location box and just hit return (i.e. not change anything), it works.

I don't know why it doesn't work either. There must be something going on when you change it manually that doesn't happen when it's changed in VBA, equivalent to the code I posted.
 
Upvote 0

Forum statistics

Threads
1,214,892
Messages
6,122,112
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top