Thread: [Solved] Can't merge mail from Excel
View Single Post
 
Old 04-05-2014, 02:17 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Mahmed1 View Post
Are you saying have a default Mail merge document already set up with all the fields and records ?
Yes, I've said this twice already.
Quote:
Ps what would the difference be in not having a template already set up?
It is not a template, it is a document. The difference in having it set up is that you don't then have to try to construct everything with code. The setup and maintenance are much easier for you that way.
Quote:
What would do these lines of code do?
.DataSource
.FirstRecord = wdDefaultFirstRecord
.Lastrecord = wdDefaultLastRecord
They tell the merge to use all the available records.
Quote:
And with the select statement, i know we are selecting everthing from excel sheet but where is the code for connecting to a provider.
That's what ".OpenDataSource Name:=strWorkbookName" does.
Quote:
Can this be easily amended so i can use a label or envelope?
Yes, by changing ".MainDocumentType = wdFormLetters".

Instead of asking questions all the time and adding in code that you don't understand, you should spend a little time: (a) learning how mailmerge works when it's not using vba; and (b) seeing what the VBA help tells you about each parameter. If you don't take the time for (a) you'll never master (b).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote