Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
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 Max Loger Excel Discussion (Misc queries) 0 June 14th 11 04:30 PM
showing path and filename Annie Excel Worksheet Functions 1 February 9th 07 01:34 PM
How to show the drive letter in the path on the title bar? Jim Excel Discussion (Misc queries) 6 July 2nd 06 10:19 AM
Path to a network drive CWillis Excel Discussion (Misc queries) 2 June 23rd 06 03:06 AM
Drive and full path in name at top of screen Mervyn Thomas Excel Discussion (Misc queries) 14 August 3rd 05 03:22 PM


All times are GMT +1. The time now is 01:13 AM.

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

About Us

"It's about Microsoft Excel"