ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   GetDirectory (https://www.excelbanter.com/excel-programming/435031-getdirectory.html)

Paul

GetDirectory
 
Is there a GetDirectory that works similar to GetFilename

joel

GetDirectory
 
GetFolder

"Paul" wrote:

Is there a GetDirectory that works similar to GetFilename


Patrick Molloy[_2_]

GetDirectory
 
just 2007 though init?

"Joel" wrote:

GetFolder

"Paul" wrote:

Is there a GetDirectory that works similar to GetFilename


Jacob Skaria

GetDirectory
 
Paul

Your query could have been little more descriptive...()

If you are looking at browsing and selecting a folder you can use the below
function to browse for a folder;

Function GetFolder() As String
Dim objShell As Object, objTemp As Object
Set objShell = CreateObject("Shell.Application")
Set objTemp = objShell.BrowseForFolder(0, "Select folder", 552)
If Not objTemp Is Nothing Then GetFolder = objTemp.Self.Path
End Function

------------------------------------------------------------------------------------------
If you are referring to GetFileName method you have a similar method within
FileSystemObject called GetFolder which returns a Folder object corresponding
to the folder in a specified path.

Syntax: (refer help)

object.GetFolder(folderspec)
object is always the name of a FileSystemObject.
folderspec is the path (absolute or relative) to a specific folder


If this post helps click Yes
---------------
Jacob Skaria


"Paul" wrote:

Is there a GetDirectory that works similar to GetFilename


JP[_4_]

GetDirectory
 
How about

http://www.vbaexpress.com/kb/getarticle.php?kb_id=284

--JP

On Oct 16, 5:40*am, Paul wrote:
Is there a GetDirectory that works similar to GetFilename



K_Macd

GetDirectory
 
Paul

The BrowseFor Folder method works quite well.

Jacob

I have only used 512 for the 3rd parameter - is 552 another option or a
typo? Note that you can set 4th parameter as a starting folder but that you
can only select that folder or subfolders. You cannot retreat back up the
tree which can be useful sometimes. Have you come across this limitation and
ever come across a remedy.

Thanks

--
Ken
"Using Dbase dialects since 82"
"Started with Visicalc in the same year"


"Jacob Skaria" wrote:

Paul

Your query could have been little more descriptive...()

If you are looking at browsing and selecting a folder you can use the below
function to browse for a folder;

Function GetFolder() As String
Dim objShell As Object, objTemp As Object
Set objShell = CreateObject("Shell.Application")
Set objTemp = objShell.BrowseForFolder(0, "Select folder", 552)
If Not objTemp Is Nothing Then GetFolder = objTemp.Self.Path
End Function

------------------------------------------------------------------------------------------
If you are referring to GetFileName method you have a similar method within
FileSystemObject called GetFolder which returns a Folder object corresponding
to the folder in a specified path.

Syntax: (refer help)

object.GetFolder(folderspec)
object is always the name of a FileSystemObject.
folderspec is the path (absolute or relative) to a specific folder


If this post helps click Yes
---------------
Jacob Skaria


"Paul" wrote:

Is there a GetDirectory that works similar to GetFilename



All times are GMT +1. The time now is 01:11 AM.

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