Solved

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

Posted on 2016-11-08
4
35 Views
Last Modified: 2016-11-09
0
Comment
Question by:Alex972
  • 2
  • 2
4 Comments
 
LVL 49

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
 

Author Comment

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

Got error when tried macro
0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 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
 

Author Closing Comment

by:Alex972
ID: 41881281
Great! Thanks
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

This is an Add-On procedure to be used in conjunction with the code provided in Reducing EE Email Clutter using Outlook (http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/A_3146-Outlook-Processing-EE-emails-on-Receive.…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

947 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

21 Experts available now in Live!

Get 1:1 Help Now