Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 06-15-2012, 06:35 AM
treflip treflip is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Jun 2012
Posts: 5
treflip is on a distinguished road
Default

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!
Reply With Quote
  #17  
Old 06-15-2012, 06:46 AM
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

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

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!
Reply With Quote
  #19  
Old 06-15-2012, 09:24 AM
Jamal NUMAN Jamal NUMAN is offline Windows 7 64bit Office 2010 64bit
Expert
 
Join Date: Nov 2010
Posts: 519
Jamal NUMAN is on a distinguished road
Lightbulb

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
Attached Images
File Type: jpg Clip_183.jpg (85.6 KB, 55 views)
File Type: jpg Clip_184.jpg (88.1 KB, 54 views)
File Type: jpg Clip_185.jpg (87.2 KB, 53 views)
File Type: jpg Clip_186.jpg (85.0 KB, 52 views)
File Type: jpg Clip_187.jpg (71.1 KB, 53 views)
Reply With Quote
  #20  
Old 06-15-2012, 09:55 AM
Jamal NUMAN Jamal NUMAN is offline Windows 7 64bit Office 2010 64bit
Expert
 
Join Date: Nov 2010
Posts: 519
Jamal NUMAN is on a distinguished road
Lightbulb

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
Attached Files
File Type: docx Captions_Paul.docx (21.8 KB, 59 views)
File Type: zip mm.zip (716.4 KB, 73 views)
Reply With Quote
  #21  
Old 06-15-2012, 06:06 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 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?
Reply With Quote
  #22  
Old 06-15-2012, 06:33 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

That suggests the document you're running the macro in doesn't have the CaptionLabel Character Style.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #23  
Old 06-16-2012, 10:00 AM
Jamal NUMAN Jamal NUMAN is offline Windows 7 64bit Office 2010 64bit
Expert
 
Join Date: Nov 2010
Posts: 519
Jamal NUMAN is on a distinguished road
Question

Quote:
Originally Posted by treflip View Post
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?
As Paul has indicated, all what you need to do is to create a new style and name it “CaptionLabel”. See the attached screenshots

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
Attached Images
File Type: jpg Clip_194.jpg (120.7 KB, 54 views)
File Type: jpg Clip_195.jpg (141.5 KB, 49 views)
Reply With Quote
  #24  
Old 09-25-2012, 10:15 PM
Mau Mau is offline Windows Vista Office 2010 32bit
Novice
 
Join Date: Sep 2012
Posts: 1
Mau is on a distinguished road
Default

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?
Reply With Quote
  #25  
Old 09-25-2012, 11:47 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

Quote:
Originally Posted by Mau View Post
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?
In that case, change the CaptionLabel Style to suit.

PS: The code to create the CaptionLabel Style with a bold font is now in the macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #26  
Old 11-04-2012, 02:46 AM
Tari Tari is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Nov 2012
Posts: 2
Tari is on a distinguished road
Default

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?
Reply With Quote
  #27  
Old 11-04-2012, 05:08 AM
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

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]
Reply With Quote
  #28  
Old 11-04-2012, 01:37 PM
Tari Tari is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Nov 2012
Posts: 2
Tari is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
That makes it a whole lot more complicated:
Code:
Sub CaptionBold()
...
End Sub
Run-time error '5917'
this object does not support attached text.

Last edited by macropod; 11-04-2012 at 01:51 PM. Reason: Deleted unnecessary replicated content
Reply With Quote
  #29  
Old 11-04-2012, 01:53 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

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]
Reply With Quote
  #30  
Old 11-15-2013, 03:16 PM
rjgs rjgs is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Nov 2013
Posts: 3
rjgs is on a distinguished road
Default 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.
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 01:19 PM.


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