View Single Post
 
Old 08-26-2014, 03:22 AM
NobodysPerfect NobodysPerfect is offline Windows 8 Office 2010 32bit
Competent Performer
 
Join Date: Jan 2014
Location: Germany
Posts: 136
NobodysPerfect is on a distinguished road
Default Resize {IncludePicture} - avoid 'Selection'

Hi to all,

I just finished the following macro, but I'd like to run it without 'Selection'. Unfortunately I do not know how to 'Set' the found { IncludePicture } field to something.

Code:
Sub ResizeIncludePicture()
Dim oField As Field, dFactor As Double
Const cNewWidth = 5

    For Each oField In ActiveDocument.Fields
        If oField.Type = wdFieldIncludePicture Then oField.Select
        With Selection.InlineShapes(1)
            dFactor = .Height / .Width
            .Width = CentimetersToPoints(cNewWidth)
            .Height = dFactor * .Width
        End With
    Next

End Sub
Any help would be appreciated - as usually

NP
Reply With Quote