ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to retrieve the directory of the currently open file? (https://www.excelbanter.com/excel-programming/273811-how-retrieve-directory-currently-open-file.html)

Joepy

How to retrieve the directory of the currently open file?
 
Hello,

I need to be able to retrieve the directory of the excel file which is
currently active.

"CurDir" does not work, because if excel is set to "C:\My Documents"
as the standard folder it always outputs this folder, although the
document is actually in "C:\WINDOWS\Desktop".

Can anyone help me with this?

Thanks,
Joepy

Ron de Bruin

How to retrieve the directory of the currently open file?
 
Try this Joepy

Sub test()
MsgBox ActiveWorkbook.Path
End Sub


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



"Joepy" wrote in message om...
Hello,

I need to be able to retrieve the directory of the excel file which is
currently active.

"CurDir" does not work, because if excel is set to "C:\My Documents"
as the standard folder it always outputs this folder, although the
document is actually in "C:\WINDOWS\Desktop".

Can anyone help me with this?

Thanks,
Joepy




John Wilson

How to retrieve the directory of the currently open file?
 
Joepy,

Try
Activeworkbook.Path

John

Joepy wrote:

Hello,

I need to be able to retrieve the directory of the excel file which is
currently active.

"CurDir" does not work, because if excel is set to "C:\My Documents"
as the standard folder it always outputs this folder, although the
document is actually in "C:\WINDOWS\Desktop".

Can anyone help me with this?

Thanks,
Joepy




All times are GMT +1. The time now is 10:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com