Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Parent Folder
I want to return the parent folder relative to the folder for the current
workbook. The following get me the path to my workbook such as c:\test\subfolder1\subfolder2. Function test() Dim myString As String myString = ThisWorkbook.Path End Function How can I modify the string to get c:\test\subfolder1 Bruce |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Parent Folder
Hi Bruce,
For xl2k ==, try something like: '=============== Public Sub Tester02() Dim strPath As String Dim strParent As String Dim pos As Long strPath = "c:\test\subfolder1\subfolder2" pos = InStrRev(strPath, "\") strParent = Left(strPath, pos - 1) MsgBox strParent End Sub '<<=============== --- Regards, Norman "Bruce" wrote in message ... I want to return the parent folder relative to the folder for the current workbook. The following get me the path to my workbook such as c:\test\subfolder1\subfolder2. Function test() Dim myString As String myString = ThisWorkbook.Path End Function How can I modify the string to get c:\test\subfolder1 Bruce |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Parent Folder
Depending on what you're doing, you could just use:
ThisWorkbook.Path & "\.." to get to the parent directory. (But this'll have trouble if you're in the root folder.) Bruce wrote: I want to return the parent folder relative to the folder for the current workbook. The following get me the path to my workbook such as c:\test\subfolder1\subfolder2. Function test() Dim myString As String myString = ThisWorkbook.Path End Function How can I modify the string to get c:\test\subfolder1 Bruce -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Parent of the embeded excel | Excel Discussion (Misc queries) | |||
A parent spreedsheet problem | Excel Discussion (Misc queries) | |||
How to determine the parent directory | Excel Programming | |||
finding the parent row of a cell in VBA | Excel Programming | |||
MultiPage Parent Name | Excel Programming |