Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-14-2011, 03:50 PM
Jamal NUMAN Jamal NUMAN is offline Windows XP Office 2007
Expert
 
Join Date: Nov 2010
Posts: 519
Jamal NUMAN is on a distinguished road
Question 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 I’m 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 don’t need to have these two parts in two styles!

How to do this in Word?



Thank you
Attached Images
File Type: jpg captionClip_76.jpg (124.0 KB, 214 views)
Reply With Quote
  #2  
Old 04-14-2011, 05:13 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 04-14-2011, 05:19 PM
Jamal NUMAN Jamal NUMAN is offline Windows XP Office 2007
Expert
 
Join Date: Nov 2010
Posts: 519
Jamal NUMAN is on a distinguished road
Question

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?




Quote:
Originally Posted by macropod View Post
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.
Reply With Quote
  #4  
Old 04-14-2011, 05:43 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Jamal NUMAN View Post
But in this case, we are going to have two styles for the caption!
No, you have one Style for the Caption and, after creating the caption, with its text, you apply a Character Style to the labe l(Table #). This is slightly different to what I posted previously, because the default caption Style is Bold and you can't unbold bold text with a Character Style. See attached document for a demonstration.

Quote:
Originally Posted by Jamal NUMAN View Post
May be we need to develop the Word Count Macto in this case as well since the caption will be divided into two styles!
I can't see why - that macro doesn't care about Styles.
Attached Files
File Type: docx Captions.docx (16.6 KB, 293 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 04-14-2011, 06:20 PM
Jamal NUMAN Jamal NUMAN is offline Windows XP Office 2007
Expert
 
Join Date: Nov 2010
Posts: 519
Jamal NUMAN is on a distinguished road
Thumbs up

Great...it did work. thank you Paul.

appreciated

jamal




Quote:
Originally Posted by macropod View Post
No, you have one Style for the Caption and, after creating the caption, with its text, you apply a Character Style to the label(Table #). This is lightly different to what I posted previously, because the default caption Style is Bold and you can't unbold bold text with a Character Style. See attached document for a demonstration.

I can't see why - that macro doesn't care about Styles.
Reply With Quote
  #6  
Old 04-14-2011, 06:34 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #7  
Old 04-14-2011, 06:54 PM
Jamal NUMAN Jamal NUMAN is offline Windows XP Office 2007
Expert
 
Join Date: Nov 2010
Posts: 519
Jamal NUMAN is on a distinguished road
Thumbs up

thank you paul.

that helps and save time

appreciated

jamal
Reply With Quote
  #8  
Old 01-07-2012, 01:41 PM
frondeur frondeur is offline Windows XP Office 2010 32bit
Novice
 
Join Date: Jan 2012
Posts: 2
frondeur is on a distinguished road
Default

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.
Reply With Quote
  #9  
Old 01-07-2012, 03:12 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #10  
Old 01-07-2012, 03:44 PM
frondeur frondeur is offline Windows XP Office 2010 32bit
Novice
 
Join Date: Jan 2012
Posts: 2
frondeur is on a distinguished road
Default

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.
Reply With Quote
  #11  
Old 01-07-2012, 11:25 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #12  
Old 06-14-2012, 10:09 PM
treflip treflip is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Jun 2012
Posts: 5
treflip is on a distinguished road
Default 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.
Reply With Quote
  #13  
Old 06-14-2012, 10:34 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #14  
Old 06-14-2012, 10:57 PM
treflip treflip is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Jun 2012
Posts: 5
treflip is on a distinguished road
Default

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!
Reply With Quote
  #15  
Old 06-14-2012, 11:03 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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

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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:13 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