I Changed Normal.dotm template.

J

jomilli

Doesnt work when other program sends txt to open Word for our reports. Tabs
go back to old template default and Font size goes to old template defualt.
when opening word for regular use, my changes are there. But when I run
reports from another program that spits out ansi txt, the Tabs and Font sizes
change. other company says they have no font or tabs settings in their
program. Somthing is changing/bypassing my default template in MSWord 2007.
This has never happend with any other MSOffice Word version in the last 15
years.
 
R

Robert M. Franz (RMF)

Hello jomilli
Doesnt work when other program sends txt to open Word for our reports. Tabs
go back to old template default and Font size goes to old template defualt.
when opening word for regular use, my changes are there. But when I run
reports from another program that spits out ansi txt, the Tabs and Font sizes
change. other company says they have no font or tabs settings in their
program. Somthing is changing/bypassing my default template in MSWord 2007.
This has never happend with any other MSOffice Word version in the last 15
years.

could you elaborate a bit more: your other application produces text
files, and you insert or open them in Word how?

2cents
Robert
 
G

Graham Mayor

While you can set the default plain text style in the normal.dotm template,
Word will ignore the changes when you open a text document, unless you force
it to use the settings you have created. The following macro in normal.dotm
will do that

Sub AutoOpen()
If LCase(Right(ActiveDocument.name, 3)) = "txt" Then
With Selection
.WholeStory
.Font.Reset
.HomeKey Unit:=wdStory
End With
End If
End Sub

or you could simply set your preferences in the macro and forget about the
style 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

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


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

jomilli

I was thinking all along a macro was changing things. Ok, how do I force Word
template to use the settings I have created? I tried to get to the macro and
see if I could change things there but it (word) wont let me open it for
editing. What should I do?

Joe
 
J

jomilli

My other program sends the asci text straight to what ever program you
associate with it. Because of our formating needs, we use word.
Unfortunately, the macro you mentioned is reseting the formating.
 
G

Graham Mayor

You would have to have the template opened in Word for the macro editor to
give access to the macros it contains. The first macro listed below, saved
in the normal template will ensure that text files with the txt extension
conform to the changes you have made to the plain text paragraph style.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

jomilli

Your code worked fine when opening a blank word document but when I selected
to use the output.txt the margins change back to the default 1'. I see where
I could set the Font and I like it, how about adding particular text in vba
about margins?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top