How can I remove the .doc file extension in a FILENAME field?

G

Guest

I am currently using word 2002 sp2, and documents that were created using an
older version of word have FILENAME fields in them, when this field updates
word adds the file extension into the field. I would like this not to
happen. Any help?
 
S

Suzanne S. Barnhill

Whether Word adds the file extension or not is based on your Windows display
settings.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
G

Graham Mayor

If you want to retain the display of extensions for your filing system
(which is not a bad plan) then you can use a macro to insert the filenames
or filenames and path using macros. If you select the field in the document
then run the appropriate macro it will be overwritten with the filename as
text without the extension. Obviously it will not update if you change the
filename. The same macro can be used to insert the filename at the cursor in
new documents.

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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top