mail merge with a picture (1 Viewer)

shutzy

Registered User.
Local time
Today, 07:24
Joined
Sep 14, 2011
Messages
775
i have been searching the internet all morning and now im getting frustrated.

i have followed many proceedures that say this works but found for me it dosnt.

if anyone has any experience of this can they tell me how to prep the field in my table for the image. at the start i had it as a hyperlink. i just basically copied and pasted the file path into my field. now i have it as standard text.

also when i get to word for the insert merge field. what should the expression look
at the minute i have
{INCLUDEPICTURE “C:\Users\chrysalis\Documents\BlueVoda\vanity-flair-uk\images oscommerce\australian body care\HandAndBodyLotion(99x300).jpg”\*MERGEFORMAT}

i have had it with \d} and so on.

i dont really want to have the image in my database as the size would balloon. i would like to stick to pointing to it and call on it at anytime i require.

thanks for looking and help, please!
 

gerry@docshop.ie

Registered User.
Local time
Today, 07:24
Joined
Jun 19, 2013
Messages
41
Perhaps you should consider creating your document from Access.

I have an access database that creates my Word Documents, all the elements of the document are stored in Access and it includes my customers logos

Set a reference to MS Word

dim wordApp As Word.Application
dim con as object
dim rs as object

Set con = Application.CurrentProject.Connection
Set wordApp = CreateObject("Word.application")

Set rs = CreateObject("ADODB.Recordset")
rs.Open "SQL to select your records" & rs5!BookId, con, 1 ' 1 = adOpenKeyset


With wordApp
.Documents.Add

'set up the code to move and enter data in your document in here



' this code is how you type the text
.Selection.TypeText Text:= rs!Mytextfield
.Selection.TypeParagraph
.Selection.TypeText Text:= "This is the text that will be entered."

'this code moves between footer
.ActiveDocument.ActiveWindow.View.SeekView = wdSeekCurrentPageFooter
'this gets from header or footer back to main document.
.ActiveDocument.ActiveWindow.View.SeekView = wdSeekMainDocument
end with


Insert a picture Path - This is from my code which inserts positions and sets the size of the image.
If Not IsNull(rs!customerlogo) Then
With wordApp.ActiveDocument.Shapes.AddPicture(FileName:=rs!customerlogo, LinkToFile:=False, SaveWithDocument:=True)
.WrapFormat.Type = wdWrapFront
.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
.RelativeVerticalPosition = wdRelativeVerticalPositionPage
.LockAspectRatio = msoCTrue
'set the width of the logo to 5cm
If .Width > wordApp.CentimetersToPoints(6) Then .Width = wordApp.CentimetersToPoints(6)
'as the logo will scale if the height is now more than 1.8cm the size will be reduced to 1.8cm and width will be to scale
If .Height > wordApp.CentimetersToPoints(1.45) Then .Height = wordApp.CentimetersToPoints(1.45)
If rs1!BookOrientation = "Landscape" Then
'place the logo 2.5 cm from the margin taking width into consideration
.Left = wordApp.CentimetersToPoints(29.7 - 2.5) - .Width
.Top = wordApp.CentimetersToPoints(16.5)
Else
.Left = wordApp.CentimetersToPoints(21 - 2.5) - .Width
.Top = wordApp.CentimetersToPoints(24.5)
End If
.PictureFormat.TransparencyColor = wdColorWhite
End With
End If
 

Users who are viewing this thread

Top Bottom