Batch apply paragraph styles to several documents?

J

jools

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

I'm trying to transfer paragraph styles from a master document to many other documents. I know about the organizer as a means of transferring paragraph styles from one document to another document.

Is it possible to batch apply paragraph styles from a source document to several other documents?

In my case, I receive documents from many different sources which need to be treated the same way. For a handful of documents it's no problem to do manually but for 50 or 60 it's very tedious. Maybe someone knows of an automator workflow for this, knows a product that does this or perhaps a totally different solution?

Many thanks for your input,

Jools
 
J

John McGhie

Hi Jools:

No, not in Word 2008. Word 2008 doesn't have the smarts for that.

Use Word 2004 or Word 2007.

Now: Batch "Apply" would be a very considerable project. How would the
machine know where to apply each style?

But batch "Update" of styles, or batch "Replacement" of styles is relatively
straightforward if you have a version of Word that contains VBA or XML or
both.

Hope this helps

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

I'm trying to transfer paragraph styles from a master document to many other
documents. I know about the organizer as a means of transferring paragraph
styles from one document to another document.

Is it possible to batch apply paragraph styles from a source document to
several other documents?

In my case, I receive documents from many different sources which need to be
treated the same way. For a handful of documents it's no problem to do
manually but for 50 or 60 it's very tedious. Maybe someone knows of an
automator workflow for this, knows a product that does this or perhaps a
totally different solution?

Many thanks for your input,

Jools

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
C

Clive Huggan

Hello Jools,

Further to John's comment, "How would the machine know where to apply each
style?", I transfer a lot of text from other sources into my own documents,
and have described the process on pages 132-134 of some notes on the way I
use Word for the Mac, titled "Bend Word to Your Will", which are available
as a free download from the Word MVPs' website
(http://word.mvps.org/Mac/Bend/BendWordToYourWill.html).

[Note: "Bend Word to your will" is designed to be used electronically and
most subjects are self-contained dictionary-style entries. If you decide to
read more widely than the item I've referred to, it's important to read the
front end of the document -- especially pages 3 and 5 -- so you can select
some Word settings that will allow you to use the document effectively.]

Cheers,

Clive Huggan
Canberra, Australia
(My time zone is 5-11 hours different from the Americas and Europe, so my
follow-on responses to those regions can be delayed)
====================================================
 
J

jools

Thank you for your replies. You are right, I worded that poorly. I mean batch transfer or copy between documents. I generally correct the formatting manually sometimes much in the manner Clive describes.

John, can you elaborate on how it works with VBA or XML and is there no hope for transferring the principle to Office 2008 (a script, an automator workflow...)? Maybe you know of a third party program?
 
J

John McGhie

Hi Jools:

The simplest way to update all the styles in a document is a single line of
VBA:

ActiveDocument.UpdateStyles

So you can create a macro that attaches the template you need:
ActiveDocument.AttachedTemplate = "Macintosh HD:Users:Shared:Letter.dot"

Then:
ActiveDocument.UpdateStyles


You build that into a "For Each ... " loop, that processes all the files in
a folder.

That last bit is a little tricky. This is code I hacked for you from
routine I use on the PC. No guarantees...

FolderSpec = "full path to the folder of input documents goes here"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(FolderSpec)
Set fc = f.Files
i = f.Files.Count

For Each f1 In fc
If f1.Type = "Microsoft Word Document" Then
With ActiveDocument
.AttachedTemplate = "Macintosh HD:Users:Shared:Letter.dot"
.UpdateStyles
.save
.close
End If
Next

Set fso = Nothing
Set f = Nothing
Set fc = Nothing
Set f1 = Nothing

Are you sure you need this as a "batch" program? A macro to attach the
correct template and update all the styles in the document is just two
lines, and I have given you both of them.

But creating a loop that will walk a whole directory is more complex,
particularly if you are not strong with coding.

As far as I know, these same method is available in AppleScript, but I don't
know AppleScript at all. If you have good AppleScript, then yes, you could
run this macro up in Word 2008. But I couldn't tell you how...

I could send you some VBA that would do it, but it wouldn't run in Word
2008.

So there is a way to do this in Word 2008, but you will need to learn
AppleScript :)

Sorry...

Thank you for your replies. You are right, I worded that poorly. I mean batch
transfer or copy between documents. I generally correct the formatting
manually sometimes much in the manner Clive describes.

John, can you elaborate on how it works with VBA or XML and is there no hope
for transferring the principle to Office 2008 (a script, an automator
workflow...)? Maybe you know of a third party program?

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Microsoft MVP, Word and Word:Mac
Sydney, Australia. mailto:[email protected]
 
J

jools

Thank you for the feedback. I imagine if there were an automator action for transferring styles from a master document one could make an automator workflow to cater for the batch processing part of it.

I will go in search of an Applescript guru, then. Does anyone have any recommendations of office/applescript programmers one could turn to?
 

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