Intergrating with Word

G

Guest

Hi,

I have an Access DB (v2003) to run a mail merge using a Word document that I
have set up.

This is all done in Access using VBA.

The code works a treat, apart from an alert that occurs from withing Word
stating the following:

Opening this document will run the following SQL command:

Select * from...... the full SQL statement

Data from your databse will be placed in the document - do you want to
continue? Yes/No

It makes no difference if I click No - my mail merge still works anyway!!

Is there any way to suppress this message?? My code looks like this:

Set objWord = GetObject("\\ FULL PATH TO DOCUMENT)"
objWord.Application.DisplayAlerts = wdAlertsNone
objWord.Application.Visible = False

objWord.MailMerge.OpenDataSource FULL PARAMETERS ARE OK
objWord.MailMerge.Execute

I would have thought objWord.Application.DisplayAlerts = wdAlertsNone would
suppress this but it doesn't

Anyone any ideas??
 
G

Guest

Hi Marek

As you are manipulating Word from within Access, try turning off the Access
warnings:

DoCmd.SetWarnings False

Not sure if it will work but, as its a one-liner, its worth a shot.

Cheers.

BW
 

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