Path of File


Posted by jssp on August 31, 2001 2:35 PM

Hello All:

How can I ask Excel to tell me the "path" of an active
file?

For example, a file opens and it writes down in a cell,
or stores in a variable, the path where it's located.

Thanks in advance!!!

Posted by Chris on August 31, 2001 2:50 PM

Hi jssp

Here's some code that I hope helps you.

Chris

Sub FilePath()

Dim FilePath As String

FilePath = ActiveWorkbook.Path

Range("a1").Value = FilePath

End Sub

alternatively you could try the following line:

range("a1").value = activeworkbook.path



Posted by jssp on August 31, 2001 3:59 PM

Thanks Chris, works great!!! (NM)