View Single Post
 
Old 02-22-2015, 10:51 PM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You cannot insert part of a field, but you can insert the path and filename on two lines with a macro e.g.

Code:
Sub InsertPathAndFilename()
    With ActiveDocument
        If Len(.Path) = 0 Then .Save
        Selection.TypeText .Path & Chr(92) & vbCr & .name
    End With
lbl_Exit:
    Exit Sub
End Sub
If you want the name without the extension change
Code:
& .name
to
Code:
& Left(.name, InStrRev(.name, ".") - 1)
http://www.gmayor.com/installing_macro.htm
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote