?
Solved

How to insert a table below each graphic inserted into a document?

Posted on 2016-11-08
4
Medium Priority
?
59 Views
Last Modified: 2016-11-09
0
Comment
Question by:Alex Campbell
  • 2
  • 2
4 Comments
 
LVL 54

Expert Comment

by:Rgonzo1971
ID: 41880094
Hi,

pls try
Sub macro()

For Each shp In ActiveDocument.InlineShapes
    If shp.Type = wdInlineShapePicture Then
        Set rng = shp.Range
        rng.Collapse Direction:=wdCollapseEnd
        rng.InsertParagraph
        rng.InsertParagraph
        Set rng = Range(rng.Start + 2, rng.Start + 2)
        rng.Tables.Add Range:=rng, NumRows:=3, NumColumns:=4
        
    End If
Next
End Sub

Open in new window

Regards
0
 
LVL 1

Author Comment

by:Alex Campbell
ID: 41881244
When I tried to run the macro I got
Sub or Function not Defined.

Got error when tried macro
0
 
LVL 54

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 41881260
then try
Sub macro()

For Each shp In ActiveDocument.InlineShapes
    If shp.Type = wdInlineShapePicture Then
        Set rng = shp.Range
        rng.Collapse Direction:=wdCollapseEnd
        rng.InsertParagraph
        rng.InsertParagraph
        Set rng = ActiveDocument.Range(rng.Start + 1, rng.Start + 1)
        rng.Tables.Add Range:=rng, NumRows:=3, NumColumns:=4
        
    End If
Next
End Sub

Open in new window

0
 
LVL 1

Author Closing Comment

by:Alex Campbell
ID: 41881281
Great! Thanks
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

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

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Manually copying shapes and their assigned macros one by one to a new location can be tedious, but if you use the Excel utility workbook attached to this article, the process will be much quicker and easier.
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Suggested Courses

601 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