XLSTART folder and Links

  • Thread starter Thread starter Andy Stokes
  • Start date Start date
A

Andy Stokes

Dear all,

Does anyone know why a link to a spreadsheet on a network drive gets changed
to point to the XLSTART folder on the user's PC? its driving me round the
bend!

Andy.
 
I know why it happens to me.

When I disconnect my pc from the network, start up excel, excel can't find my
network drive.

It reverts back to some folder on my C: drive.

Here's some code that I keep in a file that's in my XLStart folder.

Option Explicit
Sub auto_open()

'Dim FSO As Scripting.FileSystemObject
Dim FSO As Object

Const myDefaultFolder As String = "U:\my u documents\excel"

'Set FSO = New Scripting.FileSystemObject
Set FSO = CreateObject("scripting.filesystemobject")

With Application
If FSO.FolderExists(folderspec:=myDefaultFolder) Then
.DefaultFilePath = myDefaultFolder
ChDrive myDefaultFolder
ChDir myDefaultFolder
Else
MsgBox "DefaultFilePath not reset, still: " & .DefaultFilePath
End If
End With
ThisWorkbook.Close savechanges:=False

End Sub


If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
Back
Top