Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-14-2009, 11:16 AM   #1
DanJames
Newly Registered User
 
Join Date: Sep 2009
Posts: 78
Thanks: 1
Thanked 1 Time in 1 Post
DanJames is on a distinguished road
Thumbs up Mail Merge Code

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.

DanJames is offline   Reply With Quote
Old 10-14-2009, 01:51 PM   #2
HiTechCoach
Newly Registered User
 
HiTechCoach's Avatar
 
Join Date: Mar 2006
Location: Oklahoma City, OK
Posts: 4,254
Thanks: 8
Thanked 156 Times in 144 Posts
HiTechCoach is a jewel in the rough HiTechCoach is a jewel in the rough HiTechCoach is a jewel in the rough HiTechCoach is a jewel in the rough
Re: Mail Merge Code

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?
__________________
Boyd Trimmell
Specializing in Accounting, CRM, and Business solutions
Microsoft Access MVP 2010-2015 , aka
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
HiTechCoach is offline   Reply With Quote
Old 10-15-2009, 11:00 AM   #3
GaryPanic
Smoke me a Kipper,Skipper
 
Join Date: Nov 2005
Location: England
Posts: 3,180
Thanks: 5
Thanked 7 Times in 6 Posts
GaryPanic will become famous soon enough
Re: Mail Merge Code

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-

GaryPanic is offline   Reply With Quote
Old 10-16-2009, 08:37 AM   #4
DanJames
Newly Registered User
 
Join Date: Sep 2009
Posts: 78
Thanks: 1
Thanked 1 Time in 1 Post
DanJames is on a distinguished road
Re: Mail Merge Code

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 is offline   Reply With Quote
Old 10-16-2009, 08:43 AM   #5
DanJames
Newly Registered User
 
Join Date: Sep 2009
Posts: 78
Thanks: 1
Thanked 1 Time in 1 Post
DanJames is on a distinguished road
Re: Mail Merge Code

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??
DanJames is offline   Reply With Quote
Old 10-17-2009, 06:39 AM   #6
GaryPanic
Smoke me a Kipper,Skipper
 
Join Date: Nov 2005
Location: England
Posts: 3,180
Thanks: 5
Thanked 7 Times in 6 Posts
GaryPanic will become famous soon enough
Re: Mail Merge Code

huh .. no - you makre the dot files in the merge form-ADD template ....
GaryPanic is offline   Reply With Quote
Old 10-17-2009, 09:31 AM   #7
DanJames
Newly Registered User
 
Join Date: Sep 2009
Posts: 78
Thanks: 1
Thanked 1 Time in 1 Post
DanJames is on a distinguished road
Smile Re: Mail Merge Code

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.

DanJames is offline   Reply With Quote
Old 10-17-2009, 03:54 PM   #8
GaryPanic
Smoke me a Kipper,Skipper
 
Join Date: Nov 2005
Location: England
Posts: 3,180
Thanks: 5
Thanked 7 Times in 6 Posts
GaryPanic will become famous soon enough
Re: Mail Merge Code

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 is offline   Reply With Quote
Old 10-17-2009, 03:55 PM   #9
GaryPanic
Smoke me a Kipper,Skipper
 
Join Date: Nov 2005
Location: England
Posts: 3,180
Thanks: 5
Thanked 7 Times in 6 Posts
GaryPanic will become famous soon enough
Re: Mail Merge Code

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
GaryPanic is offline   Reply With Quote
Old 10-19-2009, 06:56 AM   #10
DanJames
Newly Registered User
 
Join Date: Sep 2009
Posts: 78
Thanks: 1
Thanked 1 Time in 1 Post
DanJames is on a distinguished road
Re: Mail Merge Code

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!!
DanJames is offline   Reply With Quote
Old 10-20-2009, 04:29 AM   #11
GaryPanic
Smoke me a Kipper,Skipper
 
Join Date: Nov 2005
Location: England
Posts: 3,180
Thanks: 5
Thanked 7 Times in 6 Posts
GaryPanic will become famous soon enough
Re: Mail Merge Code

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
GaryPanic is offline   Reply With Quote
Old 10-20-2009, 04:34 AM   #12
GaryPanic
Smoke me a Kipper,Skipper
 
Join Date: Nov 2005
Location: England
Posts: 3,180
Thanks: 5
Thanked 7 Times in 6 Posts
GaryPanic will become famous soon enough
Re: Mail Merge Code

here is the link to the website that gives the full instructions

http://www.members.shaw.ca/AlbertKal...rge/index.html
at the bottom there are more notes - incase you need to tweakt he location of the directory - also look at the coding - Albert has put some useful notes in the code
GaryPanic is offline   Reply With Quote
Old 12-20-2009, 04:57 AM   #13
DanJames
Newly Registered User
 
Join Date: Sep 2009
Posts: 78
Thanks: 1
Thanked 1 Time in 1 Post
DanJames is on a distinguished road
Re: Mail Merge Code

Thanks alot, and sorry for the snide remarks

DanJames is offline   Reply With Quote
Reply

Tags
mail merge , vba code

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question Word Doc mail merge - formatting issue mattkorguk General 0 11-18-2008 06:03 AM
Mail Merge through VBA DKM Modules & VBA 0 04-18-2008 01:01 PM
Opening Word Merge Letter with code....opens but no merge tool bar Mike375 General 0 03-22-2008 04:50 AM
Auto Mail Merge with TOC PROBLEM? mr_fish Modules & VBA 1 07-21-2006 01:43 AM
Mail Merge....code runs faster than computer? BigJimSlade Modules & VBA 1 08-02-2002 04:41 AM




All times are GMT -8. The time now is 10:24 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World