Filename Field 
Author Message
 Filename Field

Not really mailmerge - but hope someone can help.
Win95 & Word97.
I have several templates where "my reference" is a field to show the file
name.  I don't want it to show the .doc file extension.  Have reset all
folders in Windows Explorer to "hide known file extensions" and restarted -
but they keep reappearing!!

There doesn't seem to be a switch to hide the extension - is there are VBA
tweak?

Also, do you think the template might "remember" that I might not have had
"hide file extensions" checked when I originally created it?  If so, would
seem edit of template might work - but tedious.



Sat, 31 Aug 2002 03:00:00 GMT  
 Filename Field
Just parse the filename:

Dim fName As String
Dim grep As Integer

fName = ActiveDocument.Name
grep = Instr(fName, ".")
fName = Left(fName, grep - 1)

--
Roy Walter
Brook House Limited
http://www.brookhouse.co.uk


Quote:
> Not really mailmerge - but hope someone can help.
> Win95 & Word97.
> I have several templates where "my reference" is a field to show the file
> name.  I don't want it to show the .doc file extension.  Have reset all
> folders in Windows Explorer to "hide known file extensions" and
restarted -
> but they keep reappearing!!

> There doesn't seem to be a switch to hide the extension - is there are VBA
> tweak?

> Also, do you think the template might "remember" that I might not have had
> "hide file extensions" checked when I originally created it?  If so, would
> seem edit of template might work - but tedious.



Sat, 31 Aug 2002 03:00:00 GMT  
 Filename Field
Hi Karen,

Another solution could be this one.

Sub Auto_Open()
    Dim DocName As String
    Dim BMRange_DocName As Range
    DocName = ActiveDocument.Name ' get the name of the active document
    Set BMRange_DocName = ActiveDocument.Bookmarks("DocName").Range ' go to the
bookmark
    BMRange_DocName.Text = Left(DocName, Len(DocName) - 4) ' overwrite it with
the filename
    ActiveDocument.Bookmarks.Add "DocName", BMRange_DocName ' restores the
bookmark
End Sub

You need to add a bookmark to your document, bookmarkname DocName.
This code will find your bookmark, update it with to documentname (without
extension),
and makes sure the bookmark is restored.

Kind regards,
Bert

Quote:

> Not really mailmerge - but hope someone can help.
> Win95 & Word97.
> I have several templates where "my reference" is a field to show the file
> name.  I don't want it to show the .doc file extension.  Have reset all
> folders in Windows Explorer to "hide known file extensions" and restarted -
> but they keep reappearing!!

> There doesn't seem to be a switch to hide the extension - is there are VBA
> tweak?

> Also, do you think the template might "remember" that I might not have had
> "hide file extensions" checked when I originally created it?  If so, would
> seem edit of template might work - but tedious.



Sat, 31 Aug 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. I don't want my path/filename field to update when I print

2. File selection, resulting in filename being input into field

3. Delete .Doc for Insert Field "FileName"

4. Create a Field with FileName of SubDocument?

5. SaveAs Filename based on Form Field Value

6. Javascript error: Java object has no method or field named Filename

7. getting just the filename, not the filename path from the opendialog control

8. SHORT filename to LONG filename???

9. ? How extract filename, dir, filename, extension ?

10. Short Filename to Long Filename ???

11. Long Filename -> Short Filename

12. Common Dialog Control - Setting .filename property w/multiple filenames

 

 
Powered by phpBB® Forum Software