Integrate Word mail merge in MS Access (1 Viewer)

Kayleigh

Member
Local time
Today, 09:41
Joined
Sep 24, 2020
Messages
706
Just as an example, I imported Alberts code into your database. (Alberts original code, not my version)

I added a button with the code
Code:
Private Sub Command145_Click()
MergeAllWord "qryMailMerge"
End Sub

I am trying to use the file you provided but every time I click MergeAll the database shuts down and restarts and I have no idea what is causing it to do this. The code compiles and I have even removed the progress bar code to be on the safe side but no luck.
 

moke123

AWF VIP
Local time
Today, 05:41
Joined
Jan 11, 2013
Messages
3,852
You may have a reference to MS word which is not needed as Alberts code is late binding.
Check for missing references or remove the refernce to MSword 16.

Just noticed you had it in your db
I just changed it in the db I posted in post#15. Download it again and try it
 
Last edited:

Kayleigh

Member
Local time
Today, 09:41
Joined
Sep 24, 2020
Messages
706
Sorry I try running the code now but it will not compile 'user-defined error' if the MS Word reference not present.
 

moke123

AWF VIP
Local time
Today, 05:41
Joined
Jan 11, 2013
Messages
3,852
It's not compiling because I did not remove or comment out your code.

You used early binding in your code whereas mine (or Alberts) uses late binding so a reference to word is not needed.

Comment out your code or at least the lines that error and it is fine.
 

Kayleigh

Member
Local time
Today, 09:41
Joined
Sep 24, 2020
Messages
706
I know this is a pretty old thread but if anyone is still interested I can post my solution to this 👀
 

Users who are viewing this thread

Top Bottom