Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-20-2020, 05:04 PM
applicious applicious is offline Is there a way to standardise the size of images when doing a mailmerge? Windows 10 Is there a way to standardise the size of images when doing a mailmerge? Office 2019
Novice
Is there a way to standardise the size of images when doing a mailmerge?
 
Join Date: May 2020
Posts: 4
applicious is on a distinguished road
Default Is there a way to standardise the size of images when doing a mailmerge?


Hi,

I can't find the answer when I search in Google and in this forum - perhaps someone else has found a solution to this problem.

In this instance the users have to screenshot a Nearmaps image for solar panel placements then upload the image into a form which then gets merged in a Word template. The problem is that each user screenshots at different screen resolutions resulting in images of varying sizes. I've already constrained the inbound images by setting a fixed table to deal with very large images that the user has screenshotted, but getting smaller image sizes to maximise to the table width so that they fill the table width is the unknown.

Does anyone know how to increase an inbound image size when it comes into the document so that it fills the table?

The end result we after is for all images to be the same size in the produced quote.

Thanks,
Andre
Reply With Quote
  #2  
Old 05-20-2020, 06:03 PM
macropod's Avatar
macropod macropod is offline Is there a way to standardise the size of images when doing a mailmerge? Windows 7 64bit Is there a way to standardise the size of images when doing a mailmerge? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

There is no built-in facility for enlarging undersize images to fit a table. The following macro added to your mailmerge main document will address that for merges to new documents:
Code:
Sub MailMergeToDoc()
Application.ScreenUpdating = False
Dim Tbl As Table, iShp As InlineShape
ActiveDocument.MailMerge.Execute
For Each Tbl In ActiveDocument.Tables
  With Tbl.Range
    For Each iShp In .InlineShapes
      With iShp
        .LockAspectRatio = True
        With .Range.Cells(1)
          If .Height <> iShp.Height Then
            If .Width <> iShp.Width Then
              iShp.Height = .Height
              If iShp.Width > .Width Then
                iShp.Width = .Width
              End If
            End If
          End If
        End With
      End With
    Next
  End With
Next
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-20-2020, 08:59 PM
gmayor's Avatar
gmayor gmayor is offline Is there a way to standardise the size of images when doing a mailmerge? Windows 10 Is there a way to standardise the size of images when doing a mailmerge? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

FWIW if you use the following to run the merge, you can include the macro at merge time, though if using Paul's macro it would require a minor change to be compatible (see below)
https://www.gmayor.com/MergeAndSplit.htm



Code:
Sub FixImages(oDoc As Document)
    Application.ScreenUpdating = False
    Dim Tbl As Table, iShp As InlineShape
    For Each Tbl In oDoc.Tables
        With Tbl.Range
            For Each iShp In .InlineShapes
                With iShp
                    .LockAspectRatio = True
                    With .Range.Cells(1)
                        If .Height <> iShp.Height Then
                            If .Width <> iShp.Width Then
                                iShp.Height = .Height
                                If iShp.Width > .Width Then
                                    iShp.Width = .Width
                                End If
                            End If
                        End If
                    End With
                End With
            Next
        End With
    Next
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #4  
Old 05-20-2020, 09:59 PM
macropod's Avatar
macropod macropod is offline Is there a way to standardise the size of images when doing a mailmerge? Windows 7 64bit Is there a way to standardise the size of images when doing a mailmerge? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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
FWIW if you use the following to run the merge
By naming the macro 'MailMergeToDoc', it already intercepts the process initiated by Word's 'Edit Individual Documents' button. It is also easily worked into the Merge_To_Individual_Files macro under the Send Mailmerge Output to Individual Files topic in the Mailmerge Tips & Tricks 'Sticky' thread at the top of this forum: https://www.msofficeforums.com/mail-...ps-tricks.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 05-27-2020, 10:05 PM
applicious applicious is offline Is there a way to standardise the size of images when doing a mailmerge? Windows 10 Is there a way to standardise the size of images when doing a mailmerge? Office 2019
Novice
Is there a way to standardise the size of images when doing a mailmerge?
 
Join Date: May 2020
Posts: 4
applicious is on a distinguished road
Default

Thanks guys, looks like macros are blocked by their server. I managed to find another way around the size issue.

One thing that helped us and found by chance is that while an image is merged in a table cell as is, when merged into a Text Box, the image can be manipulated to some extent by sizing the text box to only show the parts of the merged image that you want. In our case the image had to include a specific ratio for it to be sized correctly, so we create the image with the correct ratio then use the Text Box size to crop the extra white space that we don't need shown in the final PDf.

This may help someone else that is battling with merged images in table cells or help them to come up with another idea with this info.

Thanks again!
Reply With Quote
  #6  
Old 05-27-2020, 10:36 PM
macropod's Avatar
macropod macropod is offline Is there a way to standardise the size of images when doing a mailmerge? Windows 7 64bit Is there a way to standardise the size of images when doing a mailmerge? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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 can do something similar with tables by manipulating the paragraph before/after spacing and setting the left and/or right margins outside the cell boundaries.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
image adjustments, size content

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to standardise the size of images when doing a mailmerge? size of imported images ??? yvessr Drawing and Graphics 14 05-04-2019 07:46 AM
Font size change after mailmerge (labels) Ludo_S Mail Merge 3 05-02-2016 02:34 PM
Is there a way to standardise the size of images when doing a mailmerge? Mailmerge is enlarging the size of the email Joan Mail Merge 2 10-27-2014 05:16 PM
Standardise repeated actions TiVivibi PowerPoint 0 10-10-2014 02:06 PM
Is there a way to standardise the size of images when doing a mailmerge? has anyone had any success using dynamic images in Mailmerge? bakhesh Mail Merge 1 09-29-2013 08:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:43 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