View Single Post
 
Old 01-26-2015, 04:21 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Change:
Dim StrPath As String, Resp
to:
Dim StrPath As String, Resp, i As Long, sngX As Single, sngY As Single, bRatio As Boolean, iShp As InlineShape

Below:
.LinkFormat.SourceFullName = StrPath
insert:
Code:
        i = ActiveDocument.Range(0, Selection.Range.Start).ContentControls.Count 
        If i > 0 Then
          With ActiveDocument.ContentControls(i)
            If Selection.Range.InRange(.Range) Then
              If .Type = wdContentControlPicture Then
                With .Range.InlineShapes(1)
                  sngX = .Width
                  sngY = .Height
                  bRatio = .LockAspectRatio
                  .Delete
                End With
                Set iShp = .Range.InlineShapes.AddPicture(StrPath, True, True)
                With iShp
                  .LockAspectRatio = bRatio
                  .Width = sngX
                  If bRatio = True Then
                    If .Height > sngY Then .Height = sngY
                  Else
                    .Height = sngY
                  End If
                End With
              End If
            End If
          End With
        End If
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote