#16
|
|||
|
|||
I think I'm getting confused here:
I created the New style but there is no way to apply both a bold font and an unbold font to a caption without manually going through and highlighting either the bold or unbold font. You said earlier that the style set will not unbold a font so that is why the caption style was modified to produce unbolded font. Here is where I interpret the new style 'CaptionLabel' incorrectly: It sounds as if it will be used to bold only the label part of the caption and leave the body alone. But creating a new style using character type and clicking the bold button produces the entire caption in a bold font. To clarify the inference here: The TC posted an attachment with the caption having a bold label and a normal font. Figure 1. ADC results stored using ADFM set high This looks much better than the entire thing bolded and is the formatting required for this class. To clarify my original understanding of the TC problem: Is it possible to create a caption similar to the example just given. When I say is it possible, I mean is it possible without manually changing each occurance. I think the last statement will clear up any misinterpretation between myself and the operation you described earlier. Thanks! |
#17
|
||||
|
||||
Once you've configured the two Styles correctly, you should:
• not be manually applying bold formatting to any part of the Caption - that is what the Style is for. Manually applying bold formatting defeats the purpose of having the CaptionLabel Style; and • use the macro to apply the CaptionLabel Style. Although you could do it manually, after selecting just the 'Figure 1.' part, the macro will do it more consistently ...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#18
|
|||
|
|||
Ok it sounds like this is the resource to correct the problem then. Unfortunately the steps I've taken to recreate the solution has not worked for me!
Unless you can see where I might be going wrong, I will walk through this thread from start to finish again. Thanks again! |
#19
|
|||
|
|||
Paul has provided a docx file in which the two styles are built. Please, have a look on it and see how does the same caption may contain two different styles.
Sure, after you have inserted the caption for new table, figure or equation, you need to go back and place the first part of the caption in the right style. This is might be considered a manual work. Or alternatively apply the macro provided by Paul. I think this sort of style should be built in in the word as it is very frequently used. I’m not sure If Paul agrees with this. Please, have a look on the attached screenshots in this post and the next one. Best Jamal |
#20
|
|||
|
|||
However, the contribution fully provided by Paul provides a comprehensive solution to have the same caption written in bold and unbold fully automatically.
please, find the attached files (in how to add the macro) Best Jamal |
#21
|
|||
|
|||
Thanks a lot Jamal. I can get the macro to run in Paul's doc.
However the one in my doc correctly sets the captions but ends with a run-time error '91' Object variable or With block variable not set. The debugger highlights: .Words.First.Next.Style = "CaptionLabel" Are you guys familiar with it? |
#22
|
||||
|
||||
That suggests the document you're running the macro in doesn't have the CaptionLabel Character Style.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#23
|
|||
|
|||
Quote:
I’m wondering Paul if it is possible to develop the code so that it creates the “CaptionLabel” in case it is not there! This style for caption is very academic and required by most of the institutions and worth to be built-in for the ease of the end users. Best Jamal |
#24
|
|||
|
|||
Hi all,
i have installed the macro and it works well. However, i want the CaptionLabel to be in italics as well as bold. Even though my CaptionLabel style is defined as italics, the macro just puts the caption label in bold. Any suggestions? |
#25
|
||||
|
||||
Quote:
PS: The code to create the CaptionLabel Style with a bold font is now in the macro.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#26
|
|||
|
|||
I've installed the macro and it works well for everything that is not in a text box, any option for it to apply the macro inside a text box as well?
|
#27
|
||||
|
||||
That makes it a whole lot more complicated:
Code:
Sub CaptionBold() Application.ScreenUpdating = False Dim Shp As Shape With ActiveDocument On Error Resume Next .Styles.Add "CaptionLabel", wdStyleTypeCharacter On Error GoTo 0 .Styles("CaptionLabel").Font.Bold = True .Styles("Caption").Font.Bold = False Call Processor(.Range) For Each Shp In .Shapes If Not Shp.TextFrame Is Nothing Then With Shp.TextFrame .TextRange.InsertAfter vbCr .TextRange.Paragraphs.Last.Style = "Normal" Call Processor(.TextRange) .TextRange.Characters.Last.Delete End With End If Next End With Application.ScreenUpdating = True End Sub Sub Processor(Rng As Range) With Rng With .Find .ClearFormatting .Text = "" .Style = "Caption" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute End With Do While .Find.Found With .Paragraphs.Last.Range.Duplicate .End = .Start + Len(Split(.Text, " ")(0)) + 1 .MoveEndUntil " ", wdForward .Style = "CaptionLabel" End With .Collapse wdCollapseEnd .Find.Execute Loop End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#28
|
|||
|
|||
Quote:
this object does not support attached text. Last edited by macropod; 11-04-2012 at 01:51 PM. Reason: Deleted unnecessary replicated content |
#29
|
||||
|
||||
I didn't get that error in my testing.
Can you attach a document to a post with some representative captions (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#30
|
|||
|
|||
Caption formatting
This is a great solution. Thank you. However, this solution formats in bold the caption in the text, eg: "Figure 1 shows that ...". How do I change the formatting with a style so that it would read "Figure 1 shows that ..." please? Thank you.
|
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 |