#1   Report Post  
Posted to microsoft.public.word.pagelayout
CJ CJ is offline
external usenet poster
 
Posts: 36
Default .docx in FileName

In Word 2007, is there a way to remove the file extension from the
result of the FileName field?
  #2   Report Post  
Posted to microsoft.public.word.pagelayout
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default .docx in FileName

No - you cannot insert parts of fields. You can however insert the relevant
part of the filename with a macro e.g. the following will insert the
filename and path (w/o extension) at the cursor. The second macro will
insert just the filename (w/o extension)

Sub InsertfNameAndPath()
With ActiveDocument
If Len(.Path) = 0 Then .Save
Selection.TypeText Left(.FullName, _
InStrRev(.FullName, ".") - 1)
End With
End Sub

Sub InsertFnameOnly()
With ActiveDocument
If Len(.Path) = 0 Then .Save
Selection.TypeText Left(.name, _
InStrRev(.name, ".") - 1)
End With
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




"CJ" wrote in message
...
In Word 2007, is there a way to remove the file extension from the
result of the FileName field?



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
Error opening docx file embedded into another docx file jd_mn Microsoft Word Help 0 April 28th 09 10:31 PM
Opening docx hyperlink from within a docx file Mark Microsoft Word Help 0 June 17th 08 03:58 AM
.docx Fritzy Microsoft Word Help 4 May 29th 08 06:15 AM
auto text: the word Filename precedes the actual filename. shmuelgimmel Microsoft Word Help 0 March 23rd 05 06:59 PM
Insert > Autotext is missing "filename" and "filename and path"; how to get back? StargateFan New Users 7 February 7th 05 12:17 AM


All times are GMT +1. The time now is 02:22 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"