View Single Post
 
Old 01-13-2018, 11:58 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,342
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by gmayor View Post
If you want to centralise the image it needs to be an inline shape. You can convert it, if you must, after you have centred it.
That's not necessary, actually:
Code:
Sub InsertPic()
Dim strFile As String, iShp As InlineShape, Shp As Shape, Rng As Range
On Error Resume Next
With Dialogs(wdDialogInsertPicture)
  .Display
  If .Name <> "" Then
    strFile = .Name
  Else
    Exit Sub
  End If
End With
Set Rng = Selection.Range: Rng.Collapse wdCollapseEnd
Set iShp = ActiveDocument.InlineShapes.AddPicture(strFile, False, True, Rng)
Set Shp = iShp.ConvertToShape
With Shp
  .LockAnchor = True
  .LockAspectRatio = msoTrue
  .Height = .Height / 2
  .RelativeVerticalPosition = wdRelativeVerticalPositionLine
  .Top = 0
  .RelativeHorizontalPosition = wdRelativeHorizontalPositionMargin
  .Left = wdShapeCenter
End With
Set Rng = Nothing: Set iShp = Nothing: Set Shp = Nothing
End Sub
puff: Multiple shapes can also be inserted this way, but the issue that then needs to be addressed is how their relative vertical positions are to be managed. See also:
https://www.msofficeforums.com/word-...html#post47919
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote