get the parent folder of the working folder
Mine also fails for root files, so also needs error handling.
Here's a slight change that may help with root files.
Sub GetParent()
Dim oFSO As Object
Set oFSO = CreateObject("Scripting.FileSystemObject")
With oFSO.GetFile(ActiveWorkbook.FullName).ParentFolder
If .IsRootFolder Then
'No Parent Folder
Debug.Print .Path
Else
Debug.Print .ParentFolder.Path
End If
End With
End Sub
HTH :)
--
Dana DeLouis
Win XP & Office 2003
"Bob Phillips" wrote in message
...
"NickHK" wrote in message
...
Need error checking in the situation of "C:\MyFile.xls".
Mine also fails for root files, so also needs error handling.
|