insert filename without extension .doc using fields?

M

Maroubramick

Guest
Does anybody know how to insert a document file name and NOT include the file
name extesion eg ".doc". Surely there is a switch so the filename can be
shown without the extension?
 


There is a "switch," but it's in Windows and applies to all files.

--
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.

"Maroubramick" <Maroubramick@discussions.microsoft.com> wrote in message
news:E2D45984-9B4E-451A-A588-AFDC2C44C50D@microsoft.com...
> Does anybody know how to insert a document file name and NOT include the

file
> name extesion eg ".doc". Surely there is a switch so the filename can be
> shown without the extension?


 
The following macros will insert the document name or document path and name
without the extension - add to keystroke shortcuts or toolbar buttons
http://www.gmayor.com/installing_macro.htm

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


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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Maroubramick wrote:
> Does anybody know how to insert a document file name and NOT include
> the file name extesion eg ".doc". Surely there is a switch so the
> filename can be shown without the extension?



 

Back
Top