Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How to determine the parent directory

Thank you very much all of you!

"Dana DeLouis" wrote:

Here are two additional ideas:

Sub Demo1()
Dim v
Dim s As String
Const strDB = "c:\data\aproject\database\dbfile.mdb"

v = Split(strDB, Application.PathSeparator)
v(UBound(v)) = "Reports"
s = Join(v, Application.PathSeparator)
End Sub

Sub Demo2()
Dim fso
Dim s As String
Const strDB = "c:\data\aproject\database\dbfile.mdb"

Set fso = CreateObject("Scripting.FileSystemObject")
With fso
If .FileExists(strDB) Then
s = .BuildPath(.GetFile(strDB).ParentFolder.Path, "Reports")
End If
End With
End Sub

HTH :)

--
Dana DeLouis
Win XP & Office 2003


"KS Wong" wrote in message
...
Dear all,

I have a string variable, i.e.
strDB="c:\data\aproject\database\dbfile.mdb".
I want to add a subdirectory under "c:\data\aproject\reports"
programmatically. How can I do that?

Thanks in advance!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parent of the embeded excel ARHangel Excel Discussion (Misc queries) 1 May 10th 07 11:19 AM
Creating a macro that lists directory names within a directory.... Andy Excel Programming 4 November 28th 04 06:13 AM
MultiPage Parent Name John Wilson Excel Programming 4 November 19th 04 02:42 PM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM
How does Excel determine the TEMP directory? Miso Excel Programming 3 July 31st 03 02:19 PM


All times are GMT +1. The time now is 10:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"