View Single Post
  #2   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi Barry,

You should ask this in one of the word.vba newsgroups :-)

From a quick look, I'd make one change, for sure. I'd declare an object
variable to hold the document object you're opening, rather than
repeatedly using the file name to identify the document. It's more
reliable and should execute more quickly:

Dim doc as Word.Document

Set doc = Documents.Open Name:=myFile$
doc.CopyStylesFromTemplate 'etc.
doc.Close 'etc.

I have a collection of documents (*.doc files) in a directory, and I
need them to all have the same style definitions. Unfortunately, my
template changes over time, and I needed a macro (VBA code) to copy the
styles from my updated template to all the documents. I did this in MS
Word 2000, running in the MS Windows XP (Professional) environment.

How does this look?


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)