Solved

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

Posted on 2013-01-28
4
388 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

There is a feature provided by MS Word that lets you create an Table of Contents for your Word document automatically. To use this feature for other documents there are two steps involved,   1.  Prepare your document for a table of contents (he…
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 shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

749 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