A
Alex St-Pierre
Hi!
I would like to make a mailmerge with an InlineShape that vary depending of
a mergefield. Also, I'm wondering if there is a way to put records 1-100 in
the same word file,101-200, etc..?
Thank you!
Alex
Sub MailMergeWithInlineShape()
Dim appWord As Word.Application
Dim docWord1 As Word.Document
Dim oChart As Graph.Chart
Dim c As Long
Set appWord = Word.Application
Set docWord1 = appWord.ActiveDocument
With docWord1
.InlineShapes(1).OLEFormat.Activate
Set oChart = .InlineShapes(1).OLEFormat.Object
End With
For i = 1 To 1000
With docWord1.mailmerge
.Destination = wdSendToNewDocument
With .DataSource
.FirstRecord = i
.LastRecord = i
End With
oChart.Application.DataSheet.Range("A1").Value =
..Fields("actions mondiales")
oChart.Application.DataSheet.Range("A2").Value =
..Fields("obligations canadiennes")
.Execute Pause:=False
End With
Next i
Set oChart = Nothing
Set docWord1 = Nothing
Set appWord = Nothing
End Sub
I would like to make a mailmerge with an InlineShape that vary depending of
a mergefield. Also, I'm wondering if there is a way to put records 1-100 in
the same word file,101-200, etc..?
Thank you!
Alex
Sub MailMergeWithInlineShape()
Dim appWord As Word.Application
Dim docWord1 As Word.Document
Dim oChart As Graph.Chart
Dim c As Long
Set appWord = Word.Application
Set docWord1 = appWord.ActiveDocument
With docWord1
.InlineShapes(1).OLEFormat.Activate
Set oChart = .InlineShapes(1).OLEFormat.Object
End With
For i = 1 To 1000
With docWord1.mailmerge
.Destination = wdSendToNewDocument
With .DataSource
.FirstRecord = i
.LastRecord = i
End With
oChart.Application.DataSheet.Range("A1").Value =
..Fields("actions mondiales")
oChart.Application.DataSheet.Range("A2").Value =
..Fields("obligations canadiennes")
.Execute Pause:=False
End With
Next i
Set oChart = Nothing
Set docWord1 = Nothing
Set appWord = Nothing
End Sub