Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
kuma-kami kuma-kami is offline
external usenet poster
 
Posts: 1
Default field code to return the filename without the extension

I need to return to the document the filename but without the dot and extension
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default field code to return the filename without the extension

There is no field code in Word that will do this if you have file extensions
displayed in Windows.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

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

extension

  #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



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I edit field code fieldname to exclude .doc extension? marketingcomm Microsoft Word Help 9 May 14th 07 06:39 PM
postal code with extension logan Mailmerge 1 October 11th 06 04:45 AM
How can I remove the .doc file extension in a FILENAME field? Mike Petrusko Microsoft Word Help 2 March 18th 06 06:24 AM
filename - field code, ? How to work ? [email protected] Microsoft Word Help 4 March 8th 06 03:28 PM
Can I display the FILENAME in word without the .doc extension? Mr P Microsoft Word Help 1 January 15th 05 10:45 AM


All times are GMT +1. The time now is 10:07 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"