hi
i am currently using the command
thisworkbook.path
if i want to go up a folder, and i was using html i would go ..\ but
how do i do this in VBA?
hi
i am currently using the command
thisworkbook.path
if i want to go up a folder, and i was using html i would go ..\ but
how do i do this in VBA?
Try this;
Sub Test()
Set fso = CreateObject("scripting.filesystemobject")
Set x = fso.getfolder(ThisWorkbook.Path)
MsgBox x.parentfolder
End Sub
wow - that was easy - thank you very much
U can do it using fso as FileSystemObject
and from there u can get the ParentFolder.
Hope that helps.
Parag.
"Buffyslay" <[email protected]> wrote in message
news:[email protected]...
> hi
>
> i am currently using the command
>
> thisworkbook.path
>
> if i want to go up a folder, and i was using html i would go ..\ but
> how do i do this in VBA?
>
Depending on what you are doing, you can use "\.."
for example. If I want to check on the existence of the file File2.xls in
the directory above the activeworkbook: (demo'd from the immediate window).
? activeworkbook.Path
C:\Data\Data1\Data2
sStr = ActiveWorkbook.Path & "\..\"
? sStr
C:\Data\Data1\Data2\..\
? dir(sStr & "File2.xls")
file2.xls
--
Regards,
Tom Ogilvy
"Buffyslay" <[email protected]> wrote in message
news:[email protected]...
> wow - that was easy - thank you very much
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks