|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Use multiple style sets in the same Word document (depending on which section the style is in)
I previously wrote up this question on superuser but haven't received much useful feedback as of yet. I am hoping I might have better luck here.
Quote:
|
#2
|
||||
|
||||
The easiest way to do this is to keep the sections in separate documents so the style definitions can be different. You could then merge the separate Word documents into a single PDF if needed.
If you MUST merge these into a single Word document it does become messy and you would almost certainly want to use a macro to apply a different style according to the section your style appears IF the content already exists. If the content doesn't already exist then you just need to know where you are when you are choosing styles. The macro would probably be simplest and run fastest if you had a standard way of bookmarking each section. That way, instead of iterating through every paragraph you could do a find/replace in a range.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
First, if you are going to use something as a template, save it as a template.
Second, you can only have one style definition for a particular style in a document. |
#4
|
|||
|
|||
Thanks for the replies.
Yes, I am aware that I should use a template file for something that is a template. I have inherited the current situation, where doc (yes, doc- not docx!) files are copied, pasted, and edited over and over again. I did not create it myself. Guessed: do you (or anyone else) have any suggestions on a method to keep track of what I am calling "metasections" in VBA? Some of them will contain multiple Word sections, others will only have a single Word section. As I said previously, I am experience in VBA in Excel, but not yet in Word, so I'm not sure what tools are available. |
#5
|
||||
|
||||
You can apply bookmarks to ranges in Word. This is similar to 'named ranges' in Excel. Basically, you just select the range and then add a bookmark.
If you used a standard way of naming the bookmark ranges then you could conceivably create a macro to reassign styles to a relevant name. There are multiple ways to write a macro like this but I would probably start with a concept along the following lines... Code:
Dim abmk as Bookmark For each abmk in ActiveDocument.Bookmarks If Left(abmk.Name,4) = "Meta" then 'Run a series of find/replace for changeable stylenames on abmk.Range 'where you replace 'stylename' with 'stylename & mid(abmk.Name,4)' ' of course this supposes that those styles already exist in document end if Next abmk
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#6
|
|||
|
|||
Quote:
Ok: that was an INCREDIBLY HELPFUL comparison. Thanks! In your opinion, am I better off using bookmarks, or building blocks/quickparts...? I have very little experience using any of these. |
#7
|
||||
|
||||
I don't see how building blocks could be useful to you for this problem. A building block is just a stored library item that can be retrieved at any time. It is the equivalent of pasting in previously created content from another document (without having to go to that other document first to copy it).
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help - Run-time error 91 - VBA for inserting and formatting text depending on style | mtrborges | Word VBA | 2 | 02-08-2015 11:35 PM |
Word 2010 - Style Sets not fully loading / loading properly | emilypage | Word | 3 | 11-09-2012 01:11 AM |
Word 2010 Style Sets Sampler | Charles Kenyon | Word | 0 | 05-17-2012 02:00 AM |
How to add to list of Style Sets | oscarsonthepond | Word | 3 | 09-20-2011 03:15 PM |