#1   Report Post  
Dave B.
 
Posts: n/a
Default File Name Field

I have a client that recently updated to Word 2003 and want me to update
their templates. Several of the templates have the file name field in the
footer. The client insists that before the upgrade the file name would not
show the extension, but now that I have done the upgrade it does. They want
me to make it so that when the file name show it does not show the file name
with the .doc extension. Is this possible and if so, how can I do this?

Thanks!
--
All help is greatly appreciated and I am more than willing to reciprocate
when I can.
  #2   Report Post  
Jezebel
 
Posts: n/a
Default

This is not something you can control from Word. The extension is not shown
if you've checked the 'Hide extensions for known file types' checkbox in
Windows Explorer Tools Folder options.


"Dave B." wrote in message
...
I have a client that recently updated to Word 2003 and want me to update
their templates. Several of the templates have the file name field in the
footer. The client insists that before the upgrade the file name would
not
show the extension, but now that I have done the upgrade it does. They
want
me to make it so that when the file name show it does not show the file
name
with the .doc extension. Is this possible and if so, how can I do this?

Thanks!
--
All help is greatly appreciated and I am more than willing to reciprocate
when I can.



  #3   Report Post  
Dave B.
 
Posts: n/a
Default

Jezebel, Thanks for the answer. I didn't think to look outside of Word.
Thank you again!
--
All help is greatly appreciated and I am more than willing to reciprocate
when I can.


"Jezebel" wrote:

This is not something you can control from Word. The extension is not shown
if you've checked the 'Hide extensions for known file types' checkbox in
Windows Explorer Tools Folder options.


"Dave B." wrote in message
...
I have a client that recently updated to Word 2003 and want me to update
their templates. Several of the templates have the file name field in the
footer. The client insists that before the upgrade the file name would
not
show the extension, but now that I have done the upgrade it does. They
want
me to make it so that when the file name show it does not show the file
name
with the .doc extension. Is this possible and if so, how can I do this?

Thanks!
--
All help is greatly appreciated and I am more than willing to reciprocate
when I can.




  #4   Report Post  
Graham Mayor
 
Posts: n/a
Default

Personally I would prefer to know what file extensions are being used. You
could insert the filename without the extension using a macro -

Sub InsertfNameAndPath()
Dim fname, fname2, pathname As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname = Selection.Document.FullName
fname2 = Selection.Document.Name
pathname = Left(fname, (Len(fname) - 4))
Selection.TypeText pathname
End Sub

Sub InsertFnameOnly()
Dim fname, fname2 As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname2 = Selection.Document.Name
fname = Left(fname2, (Len(fname2) - 4))
Selection.TypeText fname
End Sub


--

Graham Mayor - Word MVP

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

Dave B. wrote:
Jezebel, Thanks for the answer. I didn't think to look outside of
Word. Thank you again!

This is not something you can control from Word. The extension is
not shown if you've checked the 'Hide extensions for known file
types' checkbox in Windows Explorer Tools Folder options.


"Dave B." wrote in message
...
I have a client that recently updated to Word 2003 and want me to
update their templates. Several of the templates have the file
name field in the footer. The client insists that before the
upgrade the file name would not
show the extension, but now that I have done the upgrade it does.
They want
me to make it so that when the file name show it does not show the
file name
with the .doc extension. Is this possible and if so, how can I do
this?

Thanks!
--
All help is greatly appreciated and I am more than willing to
reciprocate when I can.



  #5   Report Post  
Jezebel
 
Posts: n/a
Default

Dim fname, fname2, pathname As String

Graham, you should know better than this! unless you really *want* to
declare fname and fname2 as variants... (but even then, it's better to be
explicit)




"Graham Mayor" wrote in message
...
Personally I would prefer to know what file extensions are being used. You
could insert the filename without the extension using a macro -

Sub InsertfNameAndPath()
Dim fname, fname2, pathname As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname = Selection.Document.FullName
fname2 = Selection.Document.Name
pathname = Left(fname, (Len(fname) - 4))
Selection.TypeText pathname
End Sub

Sub InsertFnameOnly()
Dim fname, fname2 As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname2 = Selection.Document.Name
fname = Left(fname2, (Len(fname2) - 4))
Selection.TypeText fname
End Sub


--

Graham Mayor - Word MVP

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

Dave B. wrote:
Jezebel, Thanks for the answer. I didn't think to look outside of
Word. Thank you again!

This is not something you can control from Word. The extension is
not shown if you've checked the 'Hide extensions for known file
types' checkbox in Windows Explorer Tools Folder options.


"Dave B." wrote in message
...
I have a client that recently updated to Word 2003 and want me to
update their templates. Several of the templates have the file
name field in the footer. The client insists that before the
upgrade the file name would not
show the extension, but now that I have done the upgrade it does.
They want
me to make it so that when the file name show it does not show the
file name
with the .doc extension. Is this possible and if so, how can I do
this?

Thanks!
--
All help is greatly appreciated and I am more than willing to
reciprocate when I can.







  #6   Report Post  
Graham Mayor
 
Posts: n/a
Default

I don't profess any particular expertise at vba. It did the job. Feel free
to improve upon it

--

Graham Mayor - Word MVP

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


Jezebel wrote:
Dim fname, fname2, pathname As String


Graham, you should know better than this! unless you really
*want* to declare fname and fname2 as variants... (but even then,
it's better to be explicit)




"Graham Mayor" wrote in message
...
Personally I would prefer to know what file extensions are being
used. You could insert the filename without the extension using a
macro - Sub InsertfNameAndPath()
Dim fname, fname2, pathname As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname = Selection.Document.FullName
fname2 = Selection.Document.Name
pathname = Left(fname, (Len(fname) - 4))
Selection.TypeText pathname
End Sub

Sub InsertFnameOnly()
Dim fname, fname2 As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname2 = Selection.Document.Name
fname = Left(fname2, (Len(fname2) - 4))
Selection.TypeText fname
End Sub


--

Graham Mayor - Word MVP

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

Dave B. wrote:
Jezebel, Thanks for the answer. I didn't think to look outside of
Word. Thank you again!

This is not something you can control from Word. The extension is
not shown if you've checked the 'Hide extensions for known file
types' checkbox in Windows Explorer Tools Folder options.


"Dave B." wrote in message
...
I have a client that recently updated to Word 2003 and want me to
update their templates. Several of the templates have the file
name field in the footer. The client insists that before the
upgrade the file name would not
show the extension, but now that I have done the upgrade it does.
They want
me to make it so that when the file name show it does not show the
file name
with the .doc extension. Is this possible and if so, how can I do
this?

Thanks!
--
All help is greatly appreciated and I am more than willing to
reciprocate when I can.



  #7   Report Post  
Jezebel
 
Posts: n/a
Default

It's probably the most common coding mistake. With

Dim A, B, C as string

the 'as string' applies only to C. A and B get the default declaration,
which is variant. Eg, equivalent to

Dim A as variant, B as variant, C as string

Best practice is to declare each variable on a line of its own, and to
specify the type explicitly even if it is variant.


"Graham Mayor" wrote in message
...
I don't profess any particular expertise at vba. It did the job. Feel free
to improve upon it

--

Graham Mayor - Word MVP

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


Jezebel wrote:
Dim fname, fname2, pathname As String


Graham, you should know better than this! unless you really
*want* to declare fname and fname2 as variants... (but even then,
it's better to be explicit)




"Graham Mayor" wrote in message
...
Personally I would prefer to know what file extensions are being
used. You could insert the filename without the extension using a
macro - Sub InsertfNameAndPath()
Dim fname, fname2, pathname As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname = Selection.Document.FullName
fname2 = Selection.Document.Name
pathname = Left(fname, (Len(fname) - 4))
Selection.TypeText pathname
End Sub

Sub InsertFnameOnly()
Dim fname, fname2 As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname2 = Selection.Document.Name
fname = Left(fname2, (Len(fname2) - 4))
Selection.TypeText fname
End Sub


--

Graham Mayor - Word MVP

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

Dave B. wrote:
Jezebel, Thanks for the answer. I didn't think to look outside of
Word. Thank you again!

This is not something you can control from Word. The extension is
not shown if you've checked the 'Hide extensions for known file
types' checkbox in Windows Explorer Tools Folder options.


"Dave B." wrote in message
...
I have a client that recently updated to Word 2003 and want me to
update their templates. Several of the templates have the file
name field in the footer. The client insists that before the
upgrade the file name would not
show the extension, but now that I have done the upgrade it does.
They want
me to make it so that when the file name show it does not show the
file name
with the .doc extension. Is this possible and if so, how can I do
this?

Thanks!
--
All help is greatly appreciated and I am more than willing to
reciprocate when I can.





  #8   Report Post  
Graham Mayor
 
Posts: n/a
Default

Thanks for the clarification. Will you settle for:

Sub InsertfNameAndPath()
Dim fname As String
Dim fname2 As String
Dim pathname As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname = Selection.Document.FullName
fname2 = Selection.Document.Name
pathname = Left(fname, (Len(fname) - 4))
Selection.TypeText pathname
End Sub

Sub InsertFnameOnly()
Dim fname As String
Dim fname2 As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname2 = Selection.Document.Name
fname = Left(fname2, (Len(fname2) - 4))
Selection.TypeText fname
End Sub



--

Graham Mayor - Word MVP

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


Jezebel wrote:
It's probably the most common coding mistake. With

Dim A, B, C as string

the 'as string' applies only to C. A and B get the default
declaration, which is variant. Eg, equivalent to

Dim A as variant, B as variant, C as string

Best practice is to declare each variable on a line of its own, and to
specify the type explicitly even if it is variant.


"Graham Mayor" wrote in message
...
I don't profess any particular expertise at vba. It did the job.
Feel free to improve upon it

--

Graham Mayor - Word MVP

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


Jezebel wrote:
Dim fname, fname2, pathname As String

Graham, you should know better than this! unless you really
*want* to declare fname and fname2 as variants... (but even then,
it's better to be explicit)




"Graham Mayor" wrote in message
...
Personally I would prefer to know what file extensions are being
used. You could insert the filename without the extension using a
macro - Sub InsertfNameAndPath()
Dim fname, fname2, pathname As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname = Selection.Document.FullName
fname2 = Selection.Document.Name
pathname = Left(fname, (Len(fname) - 4))
Selection.TypeText pathname
End Sub

Sub InsertFnameOnly()
Dim fname, fname2 As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname2 = Selection.Document.Name
fname = Left(fname2, (Len(fname2) - 4))
Selection.TypeText fname
End Sub


--

Graham Mayor - Word MVP

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

Dave B. wrote:
Jezebel, Thanks for the answer. I didn't think to look outside
of Word. Thank you again!

This is not something you can control from Word. The extension is
not shown if you've checked the 'Hide extensions for known file
types' checkbox in Windows Explorer Tools Folder options.


"Dave B." wrote in message
...
I have a client that recently updated to Word 2003 and want me
to update their templates. Several of the templates have the
file name field in the footer. The client insists that before
the upgrade the file name would not
show the extension, but now that I have done the upgrade it
does. They want
me to make it so that when the file name show it does not show
the file name
with the .doc extension. Is this possible and if so, how can I
do this?

Thanks!
--
All help is greatly appreciated and I am more than willing to
reciprocate when I can.



  #9   Report Post  
Jezebel
 
Posts: n/a
Default

OK, if you want 'best practice' coding ...


Sub InsertfNameAndPath()

Dim pPathname as String

With ActiveDocument
If not .Saved Then
.Save
End If

pPathname = Left$(.FullName, (Len(.FullName) - 4))
End With

Selection.TypeText pPathname

End Sub


Paraphrased from one of the coding standards ....

-- Declarations should have a prefix to show the variable scope (procedure,
module, or global)
-- Don't make comparisons explicitly with TRUE or FALSE. Doesn't actually
matter with FALSE, but "If x = TRUE then" is not the same as "If x then"
-- Don't write one-line if-statements. Nothing wrong with them per se, but
they tend to be a source of bugs when the code gets re-worked later.
-- Use the string version of functions like Left$(), Mid$() etc -- MUCH
faster than the variant equivalents.


cheers





--

Graham Mayor - Word MVP

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


Jezebel wrote:
It's probably the most common coding mistake. With

Dim A, B, C as string

the 'as string' applies only to C. A and B get the default
declaration, which is variant. Eg, equivalent to

Dim A as variant, B as variant, C as string

Best practice is to declare each variable on a line of its own, and to
specify the type explicitly even if it is variant.


"Graham Mayor" wrote in message
...
I don't profess any particular expertise at vba. It did the job.
Feel free to improve upon it

--

Graham Mayor - Word MVP

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


Jezebel wrote:
Dim fname, fname2, pathname As String

Graham, you should know better than this! unless you really
*want* to declare fname and fname2 as variants... (but even then,
it's better to be explicit)




"Graham Mayor" wrote in message
...
Personally I would prefer to know what file extensions are being
used. You could insert the filename without the extension using a
macro - Sub InsertfNameAndPath()
Dim fname, fname2, pathname As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname = Selection.Document.FullName
fname2 = Selection.Document.Name
pathname = Left(fname, (Len(fname) - 4))
Selection.TypeText pathname
End Sub

Sub InsertFnameOnly()
Dim fname, fname2 As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname2 = Selection.Document.Name
fname = Left(fname2, (Len(fname2) - 4))
Selection.TypeText fname
End Sub


--

Graham Mayor - Word MVP

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

Dave B. wrote:
Jezebel, Thanks for the answer. I didn't think to look outside
of Word. Thank you again!

This is not something you can control from Word. The extension is
not shown if you've checked the 'Hide extensions for known file
types' checkbox in Windows Explorer Tools Folder options.


"Dave B." wrote in message
...
I have a client that recently updated to Word 2003 and want me
to update their templates. Several of the templates have the
file name field in the footer. The client insists that before
the upgrade the file name would not
show the extension, but now that I have done the upgrade it
does. They want
me to make it so that when the file name show it does not show
the file name
with the .doc extension. Is this possible and if so, how can I
do this?

Thanks!
--
All help is greatly appreciated and I am more than willing to
reciprocate when I can.





  #10   Report Post  
Graham Mayor
 
Posts: n/a
Default

Thanks for that

--

Graham Mayor - Word MVP

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


Jezebel wrote:
OK, if you want 'best practice' coding ...


Sub InsertfNameAndPath()

Dim pPathname as String

With ActiveDocument
If not .Saved Then
.Save
End If

pPathname = Left$(.FullName, (Len(.FullName) - 4))
End With

Selection.TypeText pPathname

End Sub


Paraphrased from one of the coding standards ....

-- Declarations should have a prefix to show the variable scope
(procedure, module, or global)
-- Don't make comparisons explicitly with TRUE or FALSE. Doesn't
actually matter with FALSE, but "If x = TRUE then" is not the same as
"If x then" -- Don't write one-line if-statements. Nothing wrong with
them per se, but they tend to be a source of bugs when the code gets
re-worked later. -- Use the string version of functions like Left$(),
Mid$() etc -- MUCH faster than the variant equivalents.


cheers





--

Graham Mayor - Word MVP

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


Jezebel wrote:
It's probably the most common coding mistake. With

Dim A, B, C as string

the 'as string' applies only to C. A and B get the default
declaration, which is variant. Eg, equivalent to

Dim A as variant, B as variant, C as string

Best practice is to declare each variable on a line of its own, and
to specify the type explicitly even if it is variant.


"Graham Mayor" wrote in message
...
I don't profess any particular expertise at vba. It did the job.
Feel free to improve upon it

--

Graham Mayor - Word MVP

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


Jezebel wrote:
Dim fname, fname2, pathname As String

Graham, you should know better than this! unless you really
*want* to declare fname and fname2 as variants... (but even then,
it's better to be explicit)




"Graham Mayor" wrote in message
...
Personally I would prefer to know what file extensions are being
used. You could insert the filename without the extension using a
macro - Sub InsertfNameAndPath()
Dim fname, fname2, pathname As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname = Selection.Document.FullName
fname2 = Selection.Document.Name
pathname = Left(fname, (Len(fname) - 4))
Selection.TypeText pathname
End Sub

Sub InsertFnameOnly()
Dim fname, fname2 As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname2 = Selection.Document.Name
fname = Left(fname2, (Len(fname2) - 4))
Selection.TypeText fname
End Sub


--

Graham Mayor - Word MVP

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

Dave B. wrote:
Jezebel, Thanks for the answer. I didn't think to look outside
of Word. Thank you again!

This is not something you can control from Word. The extension
is not shown if you've checked the 'Hide extensions for known
file types' checkbox in Windows Explorer Tools Folder
options. "Dave B." wrote in
message
...
I have a client that recently updated to Word 2003 and want me
to update their templates. Several of the templates have the
file name field in the footer. The client insists that before
the upgrade the file name would not
show the extension, but now that I have done the upgrade it
does. They want
me to make it so that when the file name show it does not show
the file name
with the .doc extension. Is this possible and if so, how can
I do this?

Thanks!
--
All help is greatly appreciated and I am more than willing to
reciprocate when I can.





  #11   Report Post  
Graham Mayor
 
Posts: n/a
Default

Thanks for that

--

Graham Mayor - Word MVP

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


Jezebel wrote:
OK, if you want 'best practice' coding ...


Sub InsertfNameAndPath()

Dim pPathname as String

With ActiveDocument
If not .Saved Then
.Save
End If

pPathname = Left$(.FullName, (Len(.FullName) - 4))
End With

Selection.TypeText pPathname

End Sub


Paraphrased from one of the coding standards ....

-- Declarations should have a prefix to show the variable scope
(procedure, module, or global)
-- Don't make comparisons explicitly with TRUE or FALSE. Doesn't
actually matter with FALSE, but "If x = TRUE then" is not the same as
"If x then" -- Don't write one-line if-statements. Nothing wrong with
them per se, but they tend to be a source of bugs when the code gets
re-worked later. -- Use the string version of functions like Left$(),
Mid$() etc -- MUCH faster than the variant equivalents.


cheers





--

Graham Mayor - Word MVP

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


Jezebel wrote:
It's probably the most common coding mistake. With

Dim A, B, C as string

the 'as string' applies only to C. A and B get the default
declaration, which is variant. Eg, equivalent to

Dim A as variant, B as variant, C as string

Best practice is to declare each variable on a line of its own, and
to specify the type explicitly even if it is variant.


"Graham Mayor" wrote in message
...
I don't profess any particular expertise at vba. It did the job.
Feel free to improve upon it

--

Graham Mayor - Word MVP

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


Jezebel wrote:
Dim fname, fname2, pathname As String

Graham, you should know better than this! unless you really
*want* to declare fname and fname2 as variants... (but even then,
it's better to be explicit)




"Graham Mayor" wrote in message
...
Personally I would prefer to know what file extensions are being
used. You could insert the filename without the extension using a
macro - Sub InsertfNameAndPath()
Dim fname, fname2, pathname As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname = Selection.Document.FullName
fname2 = Selection.Document.Name
pathname = Left(fname, (Len(fname) - 4))
Selection.TypeText pathname
End Sub

Sub InsertFnameOnly()
Dim fname, fname2 As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname2 = Selection.Document.Name
fname = Left(fname2, (Len(fname2) - 4))
Selection.TypeText fname
End Sub


--

Graham Mayor - Word MVP

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

Dave B. wrote:
Jezebel, Thanks for the answer. I didn't think to look outside
of Word. Thank you again!

This is not something you can control from Word. The extension
is not shown if you've checked the 'Hide extensions for known
file types' checkbox in Windows Explorer Tools Folder
options. "Dave B." wrote in
message
...
I have a client that recently updated to Word 2003 and want me
to update their templates. Several of the templates have the
file name field in the footer. The client insists that before
the upgrade the file name would not
show the extension, but now that I have done the upgrade it
does. They want
me to make it so that when the file name show it does not show
the file name
with the .doc extension. Is this possible and if so, how can
I do this?

Thanks!
--
All help is greatly appreciated and I am more than willing to
reciprocate when I can.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read Sheet name from Excel file into Word field George Georgieff Mailmerge 1 June 9th 05 12:58 PM
INCLUDETEXT File is Determined by Merge Field Clint Marshall Mailmerge 2 June 1st 05 10:16 PM
How to creat relative and shorthand file path names? 2dogs Microsoft Word Help 1 May 15th 05 12:11 PM
Word Field Codes in Excel data file mranz Mailmerge 7 December 11th 04 09:02 AM
Text Form Field Ref in Footer Won't Update on Screen StarWine Microsoft Word Help 3 December 6th 04 06:17 PM


All times are GMT +1. The time now is 09:07 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"