Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 24 Jun 2008 16:36:54 -0600,    group: microsoft.public.word.conversions        back       


using a template to open a text file   
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.
date: Tue, 24 Jun 2008 16:36:54 -0600   author:   tester

Re: using a template to open a text file   
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.
>
date: Wed, 25 Jun 2008 00:09:34 -0400   author:   Herb Tyson [MVP]

Re: using a template to open a text file   
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

http://www.gmayor.com/installing_macro.htm

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

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



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.
date: Wed, 25 Jun 2008 07:10:14 +0300   author:   Graham Mayor

Re: using a template to open a text file   
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 MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


"Herb Tyson [MVP]"  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.
>>
>
date: Wed, 25 Jun 2008 09:30:48 -0400   author:   Herb Tyson [MVP]

Re: using a template to open a text file   
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

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



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]"  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.
date: Wed, 25 Jun 2008 17:34:03 +0300   author:   Graham Mayor

Re: using a template to open a text file   
Unless OP choose File - Save As (Or Office button - Save As), and specifies 
a file type that supports formatting, that is.

-- 
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


"Graham Mayor"  wrote in message 
news:eKHMICt1IHA.552@TK2MSFTNGP06.phx.gbl...
> ...none of it is going to be saved with the file.
date: Sun, 29 Jun 2008 01:03:35 -0400   author:   Herb Tyson [MVP]

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us