View Single Post
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default field code to return the filename without the extension

But you can do it with a simple macro. Use one or other of the following
depending on whether you want the file path also.

Sub InsertfNameAndPath()
Dim pPathname As String
With ActiveDocument
If Not .Saved Then
.Save
End If
pPathname = Left$(.FullName, (Len(.FullName) - 4))
End With
Selection.TypeText pPathname
End Sub

Sub InsertFnameOnly()
Dim pPathname As String
With ActiveDocument
If Not .Saved Then
.Save
End If
pPathname = Left$(.Name, (Len(.Name) - 4))
End With
Selection.TypeText pPathname
End Sub

http://www.gmayor.com/installing_macro.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Suzanne S. Barnhill wrote:
There is no field code in Word that will do this if you have file
extensions displayed in Windows.


"kuma-kami" wrote in message
...
I need to return to the document the filename but without the dot
and extension