1
votes

I'm fairly new to VBA and I'm trying to bring data from access form to a word document using bookmarks. The problem I'm having is that I'm finding it very hard to create a new in MS word with the next record. Is there a way in VBA (Access 2010) to create a page break so that I can insert the next record? I can already get any record on the first page of the word document.

Wrd.Documents.Add "\\wordDocument.dotx"
Wrd.Visible = True

x = 1

For x = 1 To LastRecord
'Replace each bookmark with current data.

With Wrd.ActiveDocument.Bookmarks
    .Item("bkDate").Range.Text = Date(x)
    .Item("bkProj").Range.Text = Proj(x)
    .Item("bkMeasID").Range.Text = MeasID(x)
    .Item("bkMeas").Range.Text = Meas(x)
    .Item("bkUnit").Range.Text = Unit(x)



    x=x+1
End With
Next x
1
I figured it out!!! All I had to do was add Wrd.Selection.InsertBreak Type:=wdPageBreakJayBec

1 Answers

1
votes

I figured it out!!!

All I had to do was add

Wrd.Selection.InsertBreak Type:=wdPageBreak