How do I execute mailmerge.opendatasource automatically when newdocument is created from template

F

Frank A Frugone

Where do I put mailmerge.opendatasource if i want it to run as soon as
the document is created from the template? I assume there's some
Initialize() method for the document, but I can't figure out where to
find it.
 
F

Frank A Frugone

Where do I put mailmerge.opendatasource if i want it to run as soon as
the document is created from the template?  I assume there's some
Initialize() method for the document, but I can't figure out where to
find it.

I tried testing out Document_New().

I used the code:
Private Sub Document_New()
With ActiveDocument
MsgBox("Hello!")
End With
End Sub

When I created a new document - nothing happened. So, I thought that
maybe a MsgBox wasn't appropriate. I then put a bookmark in the
document and tried to put text into it:

Private Sub Document_New()
With ActiveDocument
.Bookmarks("Text1").Range _
.InsertBefore "Pansy"
End With
End Sub

That didn't work either. I must be doing something wrong. But what?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top