Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Read Sheet name from Excel file into Word field | Mailmerge | |||
INCLUDETEXT File is Determined by Merge Field | Mailmerge | |||
How to creat relative and shorthand file path names? | Microsoft Word Help | |||
Word Field Codes in Excel data file | Mailmerge | |||
Text Form Field Ref in Footer Won't Update on Screen | Microsoft Word Help |