Solved

Macro or IF statement coding required for mergedfields document to resize multiple images

Posted on 2010-11-22
7
329 Views
Last Modified: 2012-05-10
This post relates similarly to a previous one here:
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Word/Q_26626676.html

The above solution works great, however, this documents layout is different therefore the macro does not work as i'd like it to.

This document lists 3 properties per page and contains 1 picture of each property and ICONS to represent the property details e.g. property type, location.

When I choose to resize the property images in this document the small images which are meant to be more like icon indicators also resize, this does not happen in my previous post but I expect its the layout of the document which causes this.

I have attached a test document but had to remove sensitive data


test-x3.doc
0
Comment
Question by:auraorange
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 22

Accepted Solution

by:
Flyster earned 500 total points
ID: 34194311
The height of your "ICONS" are 41.25 cm. Add an If statement to address shapes greater than that.

For Each oILShp In ActiveDocument.InlineShapes
With oILShp
If .Height > 41.5 Then
.Height = AspectHt(.Width, .Height, _
CentimetersToPoints(11))
.Width = CentimetersToPoints(11)
End If
End With
Next
End Sub

Flyster
0
 
LVL 2

Author Comment

by:auraorange
ID: 34194694
Thank you flyster for the feedback

Could you advise me where to put this code?

Regards, Aura
0
 
LVL 2

Author Comment

by:auraorange
ID: 34195857
Prior to an update later from yourself hopefully.

Another problem I face is that some property pictures also initially come through very small and this could conflict with the above code.

Another thought I have had is that currently the property pictures are the small "icons" are classed as JPG's, I could change the icon sized images to .PNG or another format if this would make it possible to exclude them via some coding.

Thanks, mat
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:Flyster
ID: 34198528
The code I provided was a snippet from the one you refered to in your post. The IF statement comes right after "With oILSHp." As all your ICONS are 41.25 cm, you can try changing the code to "IF .Height <> 41.25 Then". This will ignore all shapes with a height of 41.25 cm. As long as your property pictures are not 41.25 cm also, they should be reformated by the code.
0
 
LVL 44

Expert Comment

by:GRayL
ID: 34200700
Icons 42.25 cm high?  Remember the max height of a report is 22 ", including top and bottom margins, and any other controls above or below the icons.
0
 
LVL 2

Author Comment

by:auraorange
ID: 34206087
First my apologies:

1) I do not understand the code and when I run the above code I get an error
2) When I look at the icon properties it says the images are 1.46cm * 1.46cm
3) This problem seems to stem from the actual images themselves.  If i can get code or a macro to resize then that would be perfect and the most simple for people to follow (As i need to show staff how to run the merge extracts and the simpler the better

Referring back to there being a problem with the images I mean in terms of their properties.  All of them are sized to 200*150pixels but their sizes vary from about 20kb to over 1mb. I downloaded FastStone image viewer today and this reset all of the images to the same sizes and properties and when i've run the extract again the images have all loaded the correct size!  For me this workaround is ok but the people who have to do this work each week are not as computer literate as myself and using faststone would add another 10 or so points onto the instructions for them to follow.
0
 
LVL 2

Author Closing Comment

by:auraorange
ID: 34309054
Thank you.

I have found that there is an issue regarding inserting multiple jpg images into a word document as word uses a default resolution and resizes image for you, therefore, to complete this task I used FastStone Image Viewer and coverted all images to .GIF, then used adapted version of your code and this worked.  Thanks, mat
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question