Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2013-01-28
4
Medium Priority
?
403 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
ID: 38829414
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 2000 total points
ID: 38829491
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
ID: 38829672
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 2000 total points
ID: 38830455
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
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…
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.
Suggested Courses

916 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