Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-25-2015, 08:09 AM
Ricyteach Ricyteach is offline Use multiple style sets in the same Word document (depending on which section the style is in) Windows 7 64bit Use multiple style sets in the same Word document (depending on which section the style is in) Office 2013
Novice
Use multiple style sets in the same Word document (depending on which section the style is in)
 
Join Date: Feb 2015
Location: Dayton, OH
Posts: 4
Ricyteach is on a distinguished road
Default 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:
I have a document "template" (not yet a template file type - I hope to create that as described below) for a report. The report is broken up into different sections:

Code:
Letter to the Client
Table of Contents
Section I
    Title Page
    Body
        1.0
        2.0
Section II
    Title Page
    Body
        1.0
        2.0
Appendix A
    Title Page
    Body
Appendix B
    Title Page
    Body
Each major "metasection" (Letter, Sections I and II, Appendices) has different formatting requirements.

In order to avoid having a huge number of styles (e.g. Normal - Letter, Normal - Sections, Normal - Appendices), it would be nice if I could have the same style name be different depending on which section of the document it is found in. Or said another way, I would like for a document to have multiple style sets depending on the section.

Just as an example of what I am after: for the Letter section, I would like Normal to be 10 pt Times New Roman, but in Section I and Section II, I would like it to be 11 pt Garamond. Or as a second example: the Title style should be left aligned on the letter, but centered in the appendices.

Is there a way to accomplish this?

EDIT:

From the comments below it seems like VBA would be the only option to do this. My initial idea on how this could be done would be:

The user simply applies the Normal style, Title style, etc, as necessary.
The VBA code would be written so as to have a style registry of corresponding Normals and Titles, etc., for each document section (Normal 1, Normal 2, etc).
Write a routine which iterates through the styles being used in the document, selects all the parts with that style, and applies the style from the registry depending on the section.
The routine is executed with a simple command button, or when the document is saved, or printed.
Any further additional suggestions or alternative ideas on this are appreciated.

(Apologies if this has been asked before; I searched for a similar question but couldn't find one. )
Reply With Quote
  #2  
Old 02-25-2015, 10:35 PM
Guessed's Avatar
Guessed Guessed is online now Use multiple style sets in the same Word document (depending on which section the style is in) Windows 7 32bit Use multiple style sets in the same Word document (depending on which section the style is in) Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,967
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #3  
Old 02-26-2015, 08:03 AM
Charles Kenyon Charles Kenyon is offline Use multiple style sets in the same Word document (depending on which section the style is in) Windows 7 64bit Use multiple style sets in the same Word document (depending on which section the style is in) Office 2010 32bit
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,124
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

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.
Reply With Quote
  #4  
Old 03-09-2015, 08:30 AM
Ricyteach Ricyteach is offline Use multiple style sets in the same Word document (depending on which section the style is in) Windows 7 64bit Use multiple style sets in the same Word document (depending on which section the style is in) Office 2013
Novice
Use multiple style sets in the same Word document (depending on which section the style is in)
 
Join Date: Feb 2015
Location: Dayton, OH
Posts: 4
Ricyteach is on a distinguished road
Default

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.
Reply With Quote
  #5  
Old 03-09-2015, 05:00 PM
Guessed's Avatar
Guessed Guessed is online now Use multiple style sets in the same Word document (depending on which section the style is in) Windows 7 32bit Use multiple style sets in the same Word document (depending on which section the style is in) Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,967
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #6  
Old 03-09-2015, 06:47 PM
Ricyteach Ricyteach is offline Use multiple style sets in the same Word document (depending on which section the style is in) Windows 7 64bit Use multiple style sets in the same Word document (depending on which section the style is in) Office 2013
Novice
Use multiple style sets in the same Word document (depending on which section the style is in)
 
Join Date: Feb 2015
Location: Dayton, OH
Posts: 4
Ricyteach is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
You can apply bookmarks to ranges in Word. This is similar to 'named ranges' in Excel.

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.
Reply With Quote
  #7  
Old 03-09-2015, 07:11 PM
Guessed's Avatar
Guessed Guessed is online now Use multiple style sets in the same Word document (depending on which section the style is in) Windows 7 32bit Use multiple style sets in the same Word document (depending on which section the style is in) Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,967
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
Reply

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
Use multiple style sets in the same Word document (depending on which section the style is in) 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

Other Forums: Access Forums

All times are GMT -7. The time now is 05:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft