Excel 2007 CurDir acts a bit strangely. If I create a new Excel file in c:\Excel and in that file query the value of CurDir it will indeed return c:\Excel as expected.
But if I then copy that Excel file over to D:\Junk then CurDir will still return c:\Excel where the file was created, NOT the directory where the file currently resides.Sub TestCurDir() Dim DirNam As String Dim Fn As String DirNam = CurDir Fn = ActiveWorkbook.Name Stop End Sub
Is there some way to always find the CurDir value of where the file currently resides and is executing from?
Thanks.
-----------------------------------------------------------------
A kludge solution seems to be to use ActiveWorkbook.FullName as follows:
RealDir = Left(ActiveWorkbook.FullName, Len(ActiveWorkbook.FullName) - Len(ActiveWorkbook.Name))
Bookmarks