Re: Displaying only part of a filename
- From: "Graham Mayor" <gmayor@xxxxxxxx>
- Date: Thu, 19 Jan 2006 09:07:59 +0200
You can't do this with a field - Jay has offered some alternative
suggestions, but the first of the macros I posted earlier will put the part
of the filename you want at the cursor.
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
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Lori wrote:
> Graham~
>
> Thanks. We lots of ways of linking it to the save function, however
> we need to avoid that.
>
> We have a document management system that includes
> libraryname - docnumb.version -
> documentreallylongnamebecauseouruserslikethem
>
> All I want to snag is the docnumb.version, the application has way of
> placing this in statically, or a simple text, however we need it to be
> dynamic so when on the occassions when they do include the document
> number and create a new version or new document that number changes.
> AND they don't always want the number which is why we can't link it
> with the save as feature.
>
> ~Lori
>
> "Graham Mayor" wrote:
>
>> As Jay says, you can't do this with a field. The macro equivalent
>> would be
>>
>> Sub InsertFnameOnly()
>> Dim pPathname As String
>> With ActiveDocument
>> If Not .Saved Then
>> .Save
>> End If
>> pPathname = Mid$(.Name, 7, 6)
>> End With
>> Selection.TypeText pPathname
>> End Sub
>>
>> However this must be peculiar to the one document. Are you simply
>> tryting to remove the filename extension? If so
>>
>> 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
>>
>> would be nearer the mark.
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>> Lori wrote:
>>> I'm trying to find a way to use the Filename field to display only
>>> part of the filename. It needs to be dynamic so if the document
>>> name changes, the field w/automatically update. I'm thinking
>>> something to the effect of inserting a field then
>>> {Mid$({FileName},7,6)}. When I toggle the code the whole thing
>>> disappears.
.
- References:
- Re: Displaying only part of a filename
- From: Graham Mayor
- Re: Displaying only part of a filename
- Prev by Date: Re: How to setup DAILY JOURNAL/TO DO LIST?
- Next by Date: Re: word locks up under my login but works perfectly for wife's lo
- Previous by thread: Re: Displaying only part of a filename
- Next by thread: Re: MSWord will only allow me to start it in safe mode.
- Index(es):
Relevant Pages
|