Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-26-2014, 03:22 AM
NobodysPerfect NobodysPerfect is offline Resize {IncludePicture} - avoid 'Selection' Windows 8 Resize {IncludePicture} - avoid 'Selection' Office 2010 32bit
Competent Performer
Resize {IncludePicture} - avoid 'Selection'
 
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
  #2  
Old 08-26-2014, 04:29 AM
macropod's Avatar
macropod macropod is offline Resize {IncludePicture} - avoid 'Selection' Windows 7 64bit Resize {IncludePicture} - avoid 'Selection' Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

You could use:
Code:
Sub ResizeIncludePicture()
Dim oField As Field, dFactor As Double
Const cNewWidth = 5
For Each oField In ActiveDocument.Fields
    If oField.Type = wdFieldIncludePicture Then
        With oField.Result.InlineShapes(1)
            dFactor = .Height / .Width
            .Width = CentimetersToPoints(cNewWidth)
            .Height = dFactor * .Width
        End With
    End If
Next
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 08-26-2014, 04:33 AM
NobodysPerfect NobodysPerfect is offline Resize {IncludePicture} - avoid 'Selection' Windows 8 Resize {IncludePicture} - avoid 'Selection' Office 2010 32bit
Competent Performer
Resize {IncludePicture} - avoid 'Selection'
 
Join Date: Jan 2014
Location: Germany
Posts: 136
NobodysPerfect is on a distinguished road
Default

"Result" that's it

Thanks Paul
NP
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Resize {IncludePicture} - avoid 'Selection' Using IncludePicture and MailMerge to insert picture Elena Mail Merge 25 02-06-2022 05:35 PM
Resize {IncludePicture} - avoid 'Selection' IncludePicture does not refresh the pictures ragesz Mail Merge 5 10-23-2020 03:41 AM
Resize {IncludePicture} - avoid 'Selection' IncludePicture does not work in Mailmerge malalex Mail Merge 4 12-10-2013 07:09 PM
INCLUDEPICTURE with Mail Merge - showing same image on every document ccordner Word 0 10-23-2013 06:42 AM
Resize {IncludePicture} - avoid 'Selection' Selection of all Text for a specific page in word is spanning selection across pages ramsgarla Word VBA 9 12-05-2012 03:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft