(Msg. 1) Posted: Tue Jun 24, 2008 4:36 pm
Post subject: using a template to open a text file Add to elertz Archived from groups: microsoft>public>word>conversions (more info?)
Is there a way to open a text file and have it pick up the default fonts and
page settings? It always opens in word in courier font, whereas my default
font is times new roman.
Or would there be a way to run word from a command line, passing in the
template I want to use and the file I want to open.
(Msg. 2) Posted: Wed Jun 25, 2008 12:09 am
Post subject: Re: using a template to open a text file Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
What version of Word? In Word 2003 and earlier, try Tools - Templates and
Add-ins - Attach. After specifying the desired template, tick Automatically
update document styles.
<tester> wrote in message news:Ov3XOrk1IHA.4772@TK2MSFTNGP03.phx.gbl...
> Is there a way to open a text file and have it pick up the default fonts
> and page settings? It always opens in word in courier font, whereas my
> default font is times new roman.
>
> Or would there be a way to run word from a command line, passing in the
> template I want to use and the file I want to open.
>
(Msg. 3) Posted: Wed Jun 25, 2008 3:04 am
Post subject: Re: using a template to open a text file Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Text files do not support font or page information. It would however be
simple enough to apply the settings with an autoopen macro in the normal
template eg
Sub Autoopen()
If LCase(Right(ActiveDocument.name, 3)) = "txt" Then
With Selection
.WholeStory
.Font.Name = "Verdana"
.Font.Size = 14
.HomeKey Unit:=wdStory
End With
End If
End Sub
Will set the font to 14 point Verdana. If you want to add page settings,
then the simplest solution would be to record a macro of the page settings
and edit out the bits you don't need eg to set landscape mode with 1"
margins
With ActiveDocument.PageSetup
.Orientation = wdOrientLandscape
.TopMargin = CentimetersToPoints(2.54)
.BottomMargin = CentimetersToPoints(2.54)
.LeftMargin = CentimetersToPoints(2.54)
.RightMargin = CentimetersToPoints(2.54)
End With
and add the section between End With and End If i.e.
Sub Autoopen()
If LCase(Right(ActiveDocument.name, 3)) = "txt" Then
With Selection
.WholeStory
.Font.Name = "Verdana"
.Font.Size = 14
.HomeKey Unit:=wdStory
End With
With ActiveDocument.PageSetup
.Orientation = wdOrientLandscape
.TopMargin = CentimetersToPoints(2.54)
.BottomMargin = CentimetersToPoints(2.54)
.LeftMargin = CentimetersToPoints(2.54)
.RightMargin = CentimetersToPoints(2.54)
End With
End If
End Sub
This macro would only apply the formatting to text documents being named
filename.txt and would ignore
other documents. You may also encounter the problem addressed at
http://word.mvps.org/FAQs/Formatting/CleanWebText.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
tester wrote:
> Is there a way to open a text file and have it pick up the default
> fonts and page settings? It always opens in word in courier font,
> whereas my default font is times new roman.
>
> Or would there be a way to run word from a command line, passing in
> the template I want to use and the file I want to open.
(Msg. 4) Posted: Wed Jun 25, 2008 9:30 am
Post subject: Re: using a template to open a text file Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
PS... the formatting Word uses for text files is determined by a style. When
you open a text file, Word applies the Plain Text style to what you opened.
By default, Word is using Normal.dot (or Normal.dotm in Word 2007) for the
formatting. So, the approach of applying a template to it would work
immediately only if you were to redefine the Plain Text style... which I
don't think you want to do.
Rather than that, using Graham Mayor's suggested AutoOpen macro provides one
solution.
An easier and perhaps quicker solution would be to press Ctrl+A, then
Ctrl+Shift+N, which applies the Normal style to the text document, giving
you a starting point that has your basic formatting defaults.
Another option is to use Word's AutoFormat command, which will also convert
text with hard line breaks into wrapped paragraphs as well as apply heading
styles where appropriate (usually): Format - AutoFormat.
"Herb Tyson [MVP]" <herb DeleteThis @1x2y3z.xnw> wrote in message
news:e5onPln1IHA.5560@TK2MSFTNGP02.phx.gbl...
> What version of Word? In Word 2003 and earlier, try Tools - Templates and
> Add-ins - Attach. After specifying the desired template, tick
> Automatically update document styles.
>
> --
> Herb Tyson MS MVP
> Author of the Word 2007 Bible
> Blog: http://word2007bible.herbtyson.com > Web: http://www.herbtyson.com >
>
> <tester> wrote in message news:Ov3XOrk1IHA.4772@TK2MSFTNGP03.phx.gbl...
>> Is there a way to open a text file and have it pick up the default fonts
>> and page settings? It always opens in word in courier font, whereas my
>> default font is times new roman.
>>
>> Or would there be a way to run word from a command line, passing in the
>> template I want to use and the file I want to open.
>>
>
(Msg. 5) Posted: Wed Jun 25, 2008 5:34 pm
Post subject: Re: using a template to open a text file Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
In Word 2007, even if you change the plain text style, the opening of a text
document does not automatically adopt all the settings that may be applied
in that style eg a change of font or a size larger than (off the top of my
head I think it is) 10.5 points will be ignored even though the stylename is
applied.
You could open the document then reset the style to force the document to
adopt the changes that you have made to the plain text style i.e. CTRL+A
then CTRL+Space, or its macro equivalent, but if you are going that far, you
may as well use the automacro to apply the required appearance. Whether you
use this or Herb's suggestion of applying normal style, none of it is going
to be saved with the file.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
Herb Tyson [MVP] wrote:
> PS... the formatting Word uses for text files is determined by a
> style. When you open a text file, Word applies the Plain Text style
> to what you opened. By default, Word is using Normal.dot (or
> Normal.dotm in Word 2007) for the formatting. So, the approach of
> applying a template to it would work immediately only if you were to
> redefine the Plain Text style... which I don't think you want to do.
>
> Rather than that, using Graham Mayor's suggested AutoOpen macro
> provides one solution.
>
> An easier and perhaps quicker solution would be to press Ctrl+A, then
> Ctrl+Shift+N, which applies the Normal style to the text document,
> giving you a starting point that has your basic formatting defaults.
>
> Another option is to use Word's AutoFormat command, which will also
> convert text with hard line breaks into wrapped paragraphs as well as
> apply heading styles where appropriate (usually): Format - AutoFormat.
>
>
> "Herb Tyson [MVP]" <herb.TakeThisOut@1x2y3z.xnw> wrote in message
> news:e5onPln1IHA.5560@TK2MSFTNGP02.phx.gbl...
>> What version of Word? In Word 2003 and earlier, try Tools -
>> Templates and Add-ins - Attach. After specifying the desired
>> template, tick Automatically update document styles.
>>
>> --
>> Herb Tyson MS MVP
>> Author of the Word 2007 Bible
>> Blog: http://word2007bible.herbtyson.com >> Web: http://www.herbtyson.com >>
>>
>> <tester> wrote in message
>> news:Ov3XOrk1IHA.4772@TK2MSFTNGP03.phx.gbl...
>>> Is there a way to open a text file and have it pick up the default
>>> fonts and page settings? It always opens in word in courier font,
>>> whereas my default font is times new roman.
>>>
>>> Or would there be a way to run word from a command line, passing in
>>> the template I want to use and the file I want to open.
(Msg. 6) Posted: Sun Jun 29, 2008 1:03 am
Post subject: Re: using a template to open a text file Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Unless OP choose File - Save As (Or Office button - Save As), and specifies
a file type that supports formatting, that is.
"Graham Mayor" <gmayor.RemoveThis@REMOVETHISmvps.org> wrote in message
news:eKHMICt1IHA.552@TK2MSFTNGP06.phx.gbl...
> ...none of it is going to be saved with the file.
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum