#1
|
|||
|
|||
how to have two formats in the Caption style: Label number - text?
How to have two formats in the Caption style: Label number - text?
Please, see the attached image that shows my question What Im looking for is to have the Label and the number of the caption in bold format and to keep the caption text without bold. Also, I dont need to have these two parts in two styles! How to do this in Word? Thank you |
#2
|
||||
|
||||
Hi Jamal,
You can apply a Character Style (which you will have to define) to the text that follows the caption, so that only the 'Table #' has the bold attribute.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
But in this case, we are going to have two styles for the caption!
May be we need to develop the Word Count Macto in this case as well since the caption will be divided into two styles! what do you think? |
#4
|
||||
|
||||
Quote:
I can't see why - that macro doesn't care about Styles.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Great...it did work. thank you Paul.
appreciated jamal Quote:
|
#6
|
||||
|
||||
Hi Jamal,
Here's a macro to apply the 'CaptionLabel' Style to all caption labels in your document. Code:
Sub CaptionBold() Application.ScreenUpdating = False Dim RngCap As Range With ActiveDocument On Error Resume Next .Styles.Add "CaptionLabel", wdStyleTypeCharacter On Error GoTo 0 .Styles("CaptionLabel").Font.Bold = True .Styles("Caption").Font.Bold = False With .Range With .Find .ClearFormatting .Text = "" .Style = "Caption" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = True .Execute End With Do While .Find.Found Set RngCap = .Words.First With RngCap .MoveEnd wdWord, 1 .Style = "CaptionLabel" End With .Collapse wdCollapseEnd .Find.Execute Loop End With End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
thank you paul.
that helps and save time appreciated jamal |
#8
|
|||
|
|||
The macro works great, but could anyone help modify it so that it would be possible to use chapter numbers in figure labels as well... currently the macro only applies bold to the first number in the caption label.
|
#9
|
||||
|
||||
Hi frondeur,
How is the chapter # formatted as part of the caption, and do all the captions include the Chapter #?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
Hi macropod,
Including the chapter number just adds figures to the caption label, and you have the possibility of choosing the separator. So instead of "Figure 1 This is the ..." you would have "Figure 1.1 This is the ..." or "Figure 1.2.5 This is the ..." or "Figure 1-3-5 This is the ..." etc. So basically the macro could work if it was able to select text from the beginning of a caption until the second space and then apply the CaptionLabel character style. I've done it with custom search and replace strings so far, but having the possibility to automate the process further would be nice. Zero experience in writing macros unfortunately. And secondly - is there a way to run a macro along with adding a caption? That way it would work completely in the background and show real-time updates. I'm preparing a template and some end-users might not feel comfortable with any additional tasks. |
#11
|
||||
|
||||
Hi frondeur,
You can't make this something that automatically occurs in the background as part of the captioning. Try: Code:
Sub CaptionBold() Application.ScreenUpdating = False Dim RngCap As Range With ActiveDocument On Error Resume Next .Styles.Add "CaptionLabel", wdStyleTypeCharacter On Error GoTo 0 .Styles("CaptionLabel").Font.Bold = True .Styles("Caption").Font.Bold = False With .Range With .Find .ClearFormatting .Text = "" .Style = "Caption" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = True .Execute End With Do While .Find.Found Set RngCap = .Paragraphs.Last.Range.Duplicate With RngCap .End = .Start + Len(Split(.Text, " ")(0)) + 1 .MoveEndUntil " ", wdForward .Style = "CaptionLabel" End With .Collapse wdCollapseEnd .Find.Execute Loop End With End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
Please explain how to modify styles and add macro
Hello, I am needing the same style for my figures and tables. I am new to styles and macros though. Can you please explain how to set up the styles and macro to enable this option? Thank you.
I am hoping by using this style and macro I can have my captions automatically have a bold label and normal description. |
#13
|
||||
|
||||
Word comes with a paragraph Style named 'Caption', which you can modify to remove the bold font attribute. To implement the solution described above, you need a new character Style named 'CaptionLabel', with the bold attribute. The macro automates the 'CaptionLabel' Style's creation and the modification of the existing 'Caption' Style. To see how to create and manage Styles manually in Word, go to:
Understanding Styles in Microsoft Word - A Tutorial in the Intermediate Users Guide to Microsoft Word To see how to install and use the macro, go to: Installing Macros
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#14
|
|||
|
|||
Thanks for the quick response!
I was able to change caption. I was able to apply the macro. I was not able to make a char style that creates a bold label and normal body text. I briefed through the site and would spend more time on it but it's 2am and I have class in the morning! I did not see what I would use to create the style except maybe the word object inside another? but that seems overkill. If possible in an way that won't be too much trouble for you, can you reference me here with a way to do it? Thanks! |
#15
|
||||
|
||||
On the Styles tab, click the little arrow in the lower right corner. Then click the 'New Styles' button. Give the new Style the 'CaptionLabel' name and choose the 'Character' type. Click the Bold button, then 'OK'. That's all there is to it.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Matching text style to drawing object style | notarichman | PowerPoint | 0 | 03-07-2011 11:34 AM |
One line of text - two formats? | judicial85 | Word | 4 | 02-18-2011 04:24 AM |
Formatting of TOC's generated based on the "Caption" style | JustinWord1000 | Word | 1 | 02-15-2011 03:13 PM |
unwanted text in a label | J J J J | Word | 0 | 11-22-2010 11:04 AM |
Custom caption label annoyance | zac | Word | 1 | 08-29-2010 09:56 AM |