tags:

views:

105

answers:

0

I've got a macro to past an image from the clipboard, resize it, and set the Text wrapping to TopBottom. However, I still need to be able to modify the alignment properties as you can on the "Picture Position" tab of the "Advanced Layout" dialog (you can get to that dialog if you select the picture, right click, choose "Text Wrapping" -> "More Layout Options...").

I'm a noob on StackOverflow, so it won't let me post a link to a screen shot of the dialog settings I am trying to match. You can see one though at :

www.netconnex.com/stackoverflow/WordImageAdvancedLayoutPictureProperties.png

Here is the code I have so far (the code below is write, it just looks messy in the StackOverflow code formatting, again, I'm a noob here):

Sub PasteSpecialPNG()

    Dim inline As InlineShape
    Dim shape As shape

    Selection.PasteSpecial Link:=False, DataType:=14, Placement:=wdInLine, _
        DisplayAsIcon:=False

    Selection.Select

    'I dont want the following.  I want to set Picture alignment, not the paragraph.
    'Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter


    For Each inline In Selection.InlineShapes
      inline.Borders.OutsideColor = wdColorBlack
      inline.Borders.OutsideLineStyle = wdLineStyleSingle
      inline.Borders.OutsideLineWidth = wdLineWidth100pt
      inline.LockAspectRatio = msoTrue
      '3 Inches * 96 Points Per Inch
      inline.Width = 3 * 96
      Set shape = inline.ConvertToShape
      shape.WrapFormat.Type = wdWrapTopBottom
      'Heres where I need to set the Horizontal and Vertical Alignments
      'Horizontal Alignment, Centered relative to the Column
      'Vertical Alignment, Top relative to the Line
      'Move Object With Text = True
      'Lock Anchor = True
    Next

End Sub