Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Split fullname into Drive, Path and Filename
Hello all,
I need to split up the Fullname of my workbook into Drive, Path, filename; and to check, if drive is a network share then to change the Drive to UNC. How can I achieve this in Excel ? Thanks in Advance Michael |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Split fullname into Drive, Path and Filename
Not exactly as requested - but produces the required results (?)
'----------------------------------------------------------------- Dim MyBookName As String Dim MyPath As String Dim MyDrive As String '---------------------- MyBookName = ActiveWorkbook.Name MyPath = ActiveWorkbook.Path MyDrive = Left(MyPath, 2) MsgBox (MyDrive & vbCr & MyPath & vbCr & MyBookName) '----------------------------------------------------------------------- --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Split fullname into Drive, Path and Filename
if your code will only be used on xl2000 or later, you can use the split
command varr = split(Thisworkbook.fullname,"\") This will give you a zero based array with each section of the fullname in a separate array element. Each folder will be in a separate element as well. If all you want to do is replace the drive letter with the UNC reference, you can probably just test if the second- third characters are a ":\" and if so, replace the drive letter with the UNC reference. Mid(thisworkbook.path,2,2) -- Regards, Tom Ogilvy "Michael Göhring" wrote in message ... Hello all, I need to split up the Fullname of my workbook into Drive, Path, filename; and to check, if drive is a network share then to change the Drive to UNC. How can I achieve this in Excel ? Thanks in Advance Michael |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo | Excel Discussion (Misc queries) | |||
showing path and filename | Excel Worksheet Functions | |||
How to show the drive letter in the path on the title bar? | Excel Discussion (Misc queries) | |||
Path to a network drive | Excel Discussion (Misc queries) | |||
Drive and full path in name at top of screen | Excel Discussion (Misc queries) |