path strings

  • Thread starter Thread starter Jack Clift
  • Start date Start date
J

Jack Clift

I am wondering if there is a function that returns /
converts the 'old' path format (i.e. maximum of 8
characters) from the new (long file name) format e.g.

c:\documents and settings\administrator\desktop\
=
c:\docume~1\admini~1\desktop

Thanks

Jack
 
Jack,

Not that I know of. Shouldn't be difficult though, it is just first 6 chars
& ~1. Check if that already exists if so make it ~2 etc.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Jack,

Not that I know of. Shouldn't be difficult though, it is just first 6 chars
& ~1. Check if that already exists if so make it ~2 etc.

Actually, there IS one way, if you have the Microsoft Scripting
Library installed, the FileSystemObject can do it for you (make sure
that you only use this with a saved workbook or it'll barf on the
ThisWorkbook.FullName line):

Sub ShowShortName()

Dim fso As Object

'The file to check
Dim fil As Object

Set fso = CreateObject("Scripting.FileSystemObject")

Set fil = fso.GetFile(ThisWorkbook.FullName)

MsgBox "Short path = " & fil.ShortPath _
& vbCrLf & "Short Name = " & fil.ShortName

Set fil = Nothing

Set fso = Nothing

End Sub
 
Back
Top