Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
FILENAME Field
Is there any way to use this field so that the filename that shows does NOT
include the file extension? I want to use the filename in my header, but do not want the .DOC extension to show. Thanks |
#2
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
FILENAME Field
This is a Windows setting. If you have extensions displayed in Windows, they
will be in Word as well. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA "koala824 at Comcast" wrote in message ... Is there any way to use this field so that the filename that shows does NOT include the file extension? I want to use the filename in my header, but do not want the .DOC extension to show. Thanks |
#3
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
FILENAME Field
If you want to retain the field then as Suzanne suggests you need to change
the Windows display of extensions, which will not help if others open the document. In any case it is most helpful to display extensions in Windows, so not that pratical. You can instead use a macro to insert the filename or filename and path without extension eg 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 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 and the following will type the filename without extension in the current page header Sub InsertFilenameinHeader() 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 ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader Selection.TypeText pPathname ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument 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 koala824 at Comcast wrote: Is there any way to use this field so that the filename that shows does NOT include the file extension? I want to use the filename in my header, but do not want the .DOC extension to show. Thanks |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding field names to filename | Microsoft Word Help | |||
Form field-- Filename | Microsoft Word Help | |||
Field Filename | Page Layout | |||
how do I add a filename field to a template | Microsoft Word Help | |||
filename field switches - anything besides /p? | Microsoft Word Help |