Thread: [Solved] Organize shapes
View Single Post
 
Old 04-30-2019, 05:00 PM
eduzs eduzs is offline Windows 10 Office 2010 32bit
Expert
 
Join Date: May 2017
Posts: 260
eduzs is on a distinguished road
Default Organize shapes

Hi!

I need to arrange shapes so that each figure is on a document page.
The shapes are from JPG which I drag and drop into the document (as inlineshapes).
I started with this code:

Code:
Sub ResizePic()

Dim x As Integer

With ActiveDocument.PageSetup
    .LeftMargin = CentimetersToPoints(1)
    .RightMargin = CentimetersToPoints(1)
    .TopMargin = CentimetersToPoints(1)
    .BottomMargin = CentimetersToPoints(1)
    sWidth = .PageWidth - .LeftMargin - .RightMargin
End With

For x = 1 To ActiveDocument.InlineShapes.Count
    ActiveDocument.InlineShapes(1).Width = sWidth
    ActiveDocument.InlineShapes(1).ConvertToShape
Next x

For x = 1 To ActiveDocument.Shapes.Count
    ActiveDocument.Shapes(x).WrapFormat.Type = wdWrapSquare
Next x

End Sub
After running the macro, I got all the stacked pictures remain in a single-page document, instead of 1 shape per page. I also need that the shapes fit to the document width (resize shape).

Thanks!
Reply With Quote