Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-22-2015, 10:51 PM
gmayor's Avatar
gmayor gmayor is offline Separating path from file name Windows 7 64bit Separating path from file name 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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Publisher '07--default file path markg2 Publisher 0 02-15-2014 10:22 AM
Quickly add file path name to footer nimblewit Word 2 05-03-2013 05:17 AM
Separating path from file name Relative path to a video file dedine PowerPoint 3 01-31-2013 12:55 PM
Separating path from file name File Path for Outlook 2007 pst eliz.bell Outlook 2 10-29-2011 07:04 PM
Separating path from file name get file name without Path Ziggy1 Word VBA 1 09-29-2006 07:55 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:21 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft