X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> How To Split File Path, Office 2010    
post May 6 2019, 05:38 PM

Posts: 1,305
Joined: 17-November 13
From: Orewa New Zealand

I have file paths in column A of activeSheet
I want to take the last part of the file name and put it in the next column. the last part of the file name will always be after the last \
eg:C:\Users\Michelle\Desktop\ExcelPayroll\Sample Excel\Employee Manager\3 Excel Calendars.xlsm
I dont know how long the file path will be
Then I want to turn the filepaths in column A to hyperlinks
Go to the top of the page
Start new topic
post May 6 2019, 09:23 PM

UtterAccess VIP
Posts: 3,578
Joined: 19-August 03
From: Auckland, Little Australia

Could try something like this.

Function getFileName(ByVal strFullPath As String) As String

If InStr(1, strFullPath, "\") > 1 Then
    getFileName = Mid(strFullPath, InStrRev(strFullPath, "\") + 1)
End If

End Function

Beer, natures brain defragging tool.
Go to the top of the page
post May 7 2019, 01:57 PM

Utter Access VIP
Posts: 6,283
Joined: 22-June 04
From: North Carolina

My candidate solution is
Function RtnFileName(Filename As String) As String
Dim FullName() As String

FullName = Split(Filename, "\")

RtnFileName = FullName(UBound(FullName))
End Function

Just to prove that in Excel there is usually more than one way to do things.


One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.
Please zip and attach samples. It makes life easier for those who have to figure out what you are trying to do. Thanks
Go to the top of the page

Posts in this topic

Custom Search

RSSSearch   Top   Lo-Fi    21st July 2019 - 09:18 PM