VBA SourceName method
I'm using VBA to read a text file made of files paths (path & name). I'm opening them in word and trying to resave them into .txt format for notepad/wordpad. There is no easy way to be able to find the last "\" and then use that to take all the text after it.
example: "C:\my docs\this file.doc" i would want the "this file" portion of the text
I found what seems to be a useful method (sourcename) but have no idea how to implement it
If f1 = fso.FileExists(file) Then
Documents.Open filename:=line, ConfirmConversions:=False, ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto, XMLTransform:="" 'open file
** here is where i'm looking to get just the file name**
**temp is the variabel below that should hold the file name**
ActiveDocument.SaveAs filename:=temp + ".txt", FileFormat:=wdFormatText, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False, Encoding:=1252, InsertLineBreaks:=True, AllowSubstitutions:=True, _
LineEnding:=wdCRLF 'saves file in chosen format
ActiveDocument.Close 'close file
End If
any help would be very much appreciated

