Solved

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

Posted on 2013-01-28
4
385 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
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…

914 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

15 Experts available now in Live!

Get 1:1 Help Now