Modifying AutoText in Word

  • Thread starter Thread starter Kevin E.
  • Start date Start date
K

Kevin E.

I want to insert the filename of my doc into the header or footer, but i
don't want the extension at the end of the text. How can I modify or create
an autotext to insert the text with out the ".doc" at the end? Any help or
suggestions are greatly appreciated, thanks.
 
You can't. If extensions are displayed in Windows, they'll be displayed in
the FILENAME field, and vice versa. This is system-dependent.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
 
Suzanne is correct, you can't do this with autotext, but you can do it with
macros

Sub InsertfNameAndPath()
Dim pPathname As String
With ActiveDocument
If Len(.Path) = 0 Then
.Save
End If
If Right(.name, 1) = "x" Then
pPathname = Left$(.FullName, (Len(.FullName) - 5))
Else
pPathname = Left$(.FullName, (Len(.FullName) - 4))
End If
End With
Selection.TypeText pPathname
End Sub

OR

Sub InsertFnameOnly()
Dim pPathname As String
With ActiveDocument
If Len(.Path) = 0 Then
.Save
End If
If Right(.name, 1) = "x" Then
pPathname = Left$(.name, (Len(.name) - 5))
Else
pPathname = Left$(.name, (Len(.name) - 4))
End If
End With
Selection.TypeText pPathname
End Sub

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

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top