Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Medusa Medusa is offline
external usenet poster
 
Posts: 1
Default Using a macro to insert pictures in a mailmerge template

hello there;

I've creating a mailmerge template in Word 2003. The datasource (in excel)
includes filenames for .jpg images - 1 image per record, set against text
fields (it's actually property details, with a picture of the property).

The text fields are OK, but I recorded a macro, which I attached to the
template document, to type in the 'includePicture' command. The way I want
it to work is that the users open the template, open the datasource, then run
the macro to insert the 'Include picture' command in the final column of a
Word table.

This worked fine the first time I did it, but when I have tested it again,
the process is adding an additional copy of the image against each record in
the merged document - this is incrementing by 1 each time I run the process.

The code in the macro is:
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="IncludePicture""\\\\Printserver\\cblftp\\"
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="MERGEFIELD PHOTO"
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=""""
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="\d"
Selection.Delete Unit:=wdCharacter, Count:=1
End Sub

Can anybody help?

Thanks




 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Macro to Insert Pictures into table - one per row. alex20850 Tables 1 September 26th 08 01:09 AM
Macro Help - sizing pictures Mike Microsoft Word Help 1 February 20th 08 12:28 PM
how to insert watermarked pictures into business card template please help.. frustrated Microsoft Word Help 1 September 11th 05 04:50 PM
Mailmerge with Logo's (pictures) fb0gris1091 Mailmerge 1 April 9th 05 09:41 AM
How to set a macro to insert a second page into a template A. Richardson Microsoft Word Help 5 November 30th 04 10:31 AM


All times are GMT +1. The time now is 09:15 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"