thank you
No. The fielname field always includes the extension - the only option you have is whether to include the filepath.
--
Cheers
macropod
[Microsoft MVP - Word]
"Jules" <Ju...@discussions.microsoft.com> wrote in message news:4E89B5AB-5E22-4B2D...@microsoft.com...
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
http://www.gmayor.com/installing_macro.htm
The above will insert the path at the cursor. You could add code to insert
it in one or more of the document footer ranges, but to do so would require
some knowledge of how the footers are arranged and whether any of them
already contains text - and if so where in relation to that text do you want
to add the filename.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
How about:
Sub InsertfNameAndPath()
With ActiveDocument
If Len(.Path) = 0 Then .Save
Selection.TypeText Split(.FullName, ".")(0)
End With
End Sub
--
Cheers
macropod
[Microsoft MVP - Word]
"Graham Mayor" <gma...@REMOVETHISmvps.org> wrote in message news:enbjycQ2...@TK2MSFTNGP06.phx.gbl...
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
macropod wrote:
> Hi Graham,
>
> How about:
> Sub InsertfNameAndPath()
> With ActiveDocument
> If Len(.Path) = 0 Then .Save
> Selection.TypeText Split(.FullName, ".")(0)
> End With
> End Sub
>
>
WordBasic.FileNameInfo$(ActiveDocument.FullName, 4)
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
Graham Mayor wrote:
> There's more than one way to skin a cat, however I don't like this
> method when used with filenames as there is a growing practice of
> using the full stop (period) character in filenames other than before
> the extension.
>
WordBasic.FileNameInfo$(ActiveDocument.FullName, 5) & _
WordBasic.FileNameInfo$(ActiveDocument.FullName, 4)
which frankly is just as clumsy as what I had originally - interesting
technique though. Thanks for reminding me of that page :)
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Jay Freedman wrote:
> Here's another way (courtesy of
> http://word.mvps.org/FAQs/MacrosVBA/WordBasicCommands.htm):
>
> WordBasic.FileNameInfo$(ActiveDocument.FullName, 4)
>
>
How about:
Sub InsertfNameAndPath()
With ActiveDocument
If Len(.Path) = 0 Then .Save
Selection.TypeText Left(.FullName, InStrRev(.FullName, ".") - 1)
End With
End Sub
--
Cheers
macropod
[Microsoft MVP - Word]
"Graham Mayor" <gma...@REMOVETHISmvps.org> wrote in message news:OUHwX1h2...@TK2MSFTNGP04.phx.gbl...
macropod wrote:
> OK Graham,
>
> How about:
> Sub InsertfNameAndPath()
> With ActiveDocument
> If Len(.Path) = 0 Then .Save
> Selection.TypeText Left(.FullName, InStrRev(.FullName, ".") - 1)
> End With
> End Sub
>
>