Question Mail Merge Code (1 Viewer)

DanJames

Registered User.
Local time
Yesterday, 17:10
Joined
Sep 3, 2009
Messages
78
Hi, could I please have the actual mail merge VBA code for one button, "Mail-Merge this Client" and another "Mail Merge All Clients". I have a table with each letter in one column and the address on disk of letter in the other. I have a list box with all of the letter names and I'd like the code to say open whatever letter is selected in the listbox, and then either mail merge all records OR just the one record selected. I have tried searching for this answer with super easy word ect and just cannot get the correct code, Also when I download a msaccess file I have trouble getting it onto my own database. Could someone please post the full code here? Thanks Alot, Dan.
 

HiTechCoach

Well-known member
Local time
Yesterday, 19:10
Joined
Mar 6, 2006
Messages
4,357
See:

Super Easy mail Merge

IMHO, it is a lot hard to paste the code form a post into your database that to import the object form another database.

Are you importing the objects using the menu options?
 

GaryPanic

Smoke me a Kipper,Skipper
Local time
Yesterday, 17:10
Joined
Nov 8, 2005
Messages
3,296
when you are importing th efiles - does it corrupt your d/b -
if so there is a get round -

1 - get a clean d/b make a copy (always make copies - date then so you know what version )
2 your clean d/b import supereasy word into it -Stop !!!!!!!
do not close - do not open - you need to open up the d/b in desgn mode and get to code window - then decompile and compact


there is a small problem that occurs - this should resolve it - but failing this - post the question - as a seperate thread - or check in the sample-
 

DanJames

Registered User.
Local time
Yesterday, 17:10
Joined
Sep 3, 2009
Messages
78
OK, I have that form downloaded but now I need to change all of the code to documents for the word, and the tables ect.. ?
 

DanJames

Registered User.
Local time
Yesterday, 17:10
Joined
Sep 3, 2009
Messages
78
I'm unsure about the template most of all... like shall I do C:\Desktop or something like that in there.. and what word file do I put in there??
 

GaryPanic

Smoke me a Kipper,Skipper
Local time
Yesterday, 17:10
Joined
Nov 8, 2005
Messages
3,296
huh .. no - you makre the dot files in the merge form-ADD template ....
 

DanJames

Registered User.
Local time
Yesterday, 17:10
Joined
Sep 3, 2009
Messages
78
I am unsure of what you, mean. There are no templates to click OK for and when I click "Add New Template" what shall I enter in the box, ect.. ?? Is it the address of a file or something - can you explain more simply as I'm new to mail-merge with MS Access? Thanks, Dan.
 

GaryPanic

Smoke me a Kipper,Skipper
Local time
Yesterday, 17:10
Joined
Nov 8, 2005
Messages
3,296
super easy word
you creat word templates docs (inside of the create option in super easy word )


if you read the notes on supereasy word - it is spelt out

there is no need for extra coding

you have a couple of buttons one to create a template and another to merge 1 record to a template (which will be in a list)

as long as the fields are on the form -where you click the merge button- it will word the fields do not have to be visible -just on the form

numbers (currency) may lose formating - look up switches in word to resolve


Read the super easy instructions - this is an excellent piece of work
 

GaryPanic

Smoke me a Kipper,Skipper
Local time
Yesterday, 17:10
Joined
Nov 8, 2005
Messages
3,296
Super Easy Word Merge.

Finally, some code to stop the crazy solutions to merging a single record in ms-access to a word document. Like everyone else, I asked why does this have to be so hard?

I also have a very high dislike of bookmarks, since end users can not possibly be expected to work with them when trying to create a template. My above approach is so slick, that your END USERS in most cases can figure this out WITH NO training.

In addition, this code is late binding, so it works even if your version of ms-word is different then that of ms-access.

How to use:
Simply merge the 2 forms and 2 modules of code into your application. Then place a button on you ms-access form with the following ONE LINE code.

MergeSingleWord

That is it!! You are done!. Now, just hit the "add new template" button to create a word template". Now insert your merge fields, and SAVE the document. Next, just try hitting the word merge button again. This is way cool, and easy. I will write up some better instructions, but I have included a sample form for you to try.

Note that if you do import the code into your a2000 application, then you MUST set the
"Microsoft DAO 3.6 Object Library" in the references window.

Access97 : click here for access 97 merge code

Access2000: click here for access 2000 merge code
 

DanJames

Registered User.
Local time
Yesterday, 17:10
Joined
Sep 3, 2009
Messages
78
Yes, it would be easy if you added instructions as not everyone is going to know how yuo have done it. Also I know the line of code and did not ask you for an essay of how you'r amazing but what to type in for the word template, as when I add something, say "C:\Desktop\TFY.doc" it says an error code? Thanks, and if you think that is a difficult question to answer simply GaryPanic, then just don't answer it!!
 

GaryPanic

Smoke me a Kipper,Skipper
Local time
Yesterday, 17:10
Joined
Nov 8, 2005
Messages
3,296
then you are not using super easy word -
or if you are you have not read the instructions

the word directory in super easy word is the same as the database
it also states in the instructions on super easy word that it is best to create the word docs fresh from within the mailmerge form .

adding a template is the same open the template and save - it should store it in the correct directory the word files will be in a folder called 888 or word (from memory) - Had you the instructions in the super easy word (properly) then the answer is there - snide remarks are not really welcome
 

Users who are viewing this thread

Top Bottom