![]() |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
hi all,
i tried asking for a solution to this problem a while ago on the mail merge forum but after reading about this for quite a while i think the only choice is to use a macro after the merge, https://www.msofficeforums.com/mail-...html#post77641 Essentially i need to include conditional full page letter head in my mail merge. i have formatted the letterhead to by A4 in size but whenever i run the merge with this field code, {INCLUDEPICTURE ".../pictures/Logos/{MERGEFIELD "internal_party" }.jpg \*MERGEFORMAT \d } , the picture shinks within the margin ( i believe this is because merged pictures are in line with text). Therefore i think i need a macro that selects the merged picture, sets the text wrapping to behind text, and then scale to 100%. Code:
Sub fixLetterHead() Dim shape As InlineShape Dim shapeRange As shapeRange ' iterate all selected shapes For Each shape In Selection.InlineShapes ' set with to 100 % shape.ScaleWidth = 100 ' convert to shape to get a shaperange shape.ConvertToShape Set shapeRange = Selection.shapeRange ' position relative to the page shapeRange.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage shapeRange.RelativeVerticalPosition = wdRelativeVerticalPositionPage ' anchor to 0.0 shapeRange.Top = 0 shapeRange.Left = 0 ' set to behind text shapeRange.WrapFormat.Type = wdWrapBehind Next If Selection.InlineShapes.Count > 0 Then Selection.InlineShapes(1).ScaleHeight = 100 Selection.InlineShapes(1).ScaleWidth = 100 Else Selection.shapeRange.ScaleHeight Factor:=100, _ RelativeToOriginalSize:=msoCTrue Selection.shapeRange.ScaleWidth Factor:=100, _ RelativeToOriginalSize:=msoCTrue Selection.shapeRange.WrapFormat.Type = wdWrapBehind End If End Sub ive pieced the above code together from online forums but its not working correctly. Also it only runs on selected pictures but i need to have it run for th eonly picture in the document. the picture does correctly become behind text but it doesnt scale to 100%. Am i close to having this working? if so, can someone please let me know how to amend my code? unfortunately i cant record macros to do this because word does not allow you to for pictures. or if anyone has any other suggested solutions im all ears. Whatever the solution is it needs to be completely automatic. Thank you in advance for any help. |
Tags |
formatting, picture |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Elena | Mail Merge | 25 | 02-06-2022 05:35 PM |
Microsoft Word macro to find text, select all text between brackets, and delete | helal1990 | Word VBA | 4 | 02-05-2015 03:52 PM |
![]() |
ndnd | Word VBA | 10 | 01-06-2015 01:47 PM |
![]() |
pruppert | Word | 6 | 07-16-2012 08:01 PM |
Word Editing Text for Picture format | sarun5 | Word | 2 | 05-27-2009 11:51 PM |