Solved

how do i add a caption to a floating shape not inline with MS Word VBA

Posted on 2013-01-28
4
384 Views
Last Modified: 2013-01-29
how do i add a caption to a floating shape not inline with MS Word VBA
0
Comment
Question by:Dov_B
  • 2
4 Comments
 
LVL 6

Expert Comment

by:nickinthooz
Comment Utility
In your document, drag to draw the text box over the object.
    On the Drawing Tools Format tab, in the Shape Styles group, click Shape Fill, and then click No Fill.
    In the Arrange group, click Text Wrapping, and then click the text wrapping option that you used for the object.
    Under Text Box Tools, on the Format tab, in the Arrange group, click Send Behind Text.
    Right-click the text box, and then click Format Shape.
    Click Text Box, and then set the internal margin values to 0.
    Select the object, and then click Cut in the Clipboard group on the Home tab. Or press CTRL+X.
    Click in the text box, and then click Paste in the Clipboard group on the Home tab. Or press CTRL+V.
    Select the object, and insert the caption.

taken from here:
http://office.microsoft.com/en-us/word-help/add-captions-in-word-HA102227021.aspx
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
Comment Utility
This inserts a caption for the first shape in a document.
    ActiveDocument.Shapes(1).Select
    Selection.InsertCaption "Figure", , , wdCaptionPositionBelow

Open in new window

0
 

Author Comment

by:Dov_B
Comment Utility
Thanks GrahamSkan can you help me with a few issues:
1) it makes a very large caption box Ineed just a teeny one for a number
2.how do iset the font
3) how do I make it see through
0
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 500 total points
Comment Utility
The box is the same width as the shape that it is labelling. You can access the box and its properties so:
Sub AddSmallTransparentCaption()
    Dim sh As Shape
    Dim tb As Shape
    Dim s As Integer

    s = 1
    
    Set sh = ActiveDocument.Shapes(s)
    sh.Select
    Selection.InsertCaption "Figure", , , wdCaptionPositionBelow
    
    Set tb = ActiveDocument.Shapes(s + 1)
    With tb
        .TextFrame.TextRange.Font.Size = 6
        .Fill.Transparency = 1
        .TextFrame.AutoSize = True 'doesn't seem to work
    End With
End Sub

Open in new window

You will see that I have commented that Autosize doesn't work. If it doesn't work on your system either, you will have to have to use the properties of the textbox to change it, e.g.
    tb.Width = 30
    tb.Height = 10

Open in new window

I don't know of a simple way to calculate the size, so trial and error would be needed.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than man…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now