suppressing requestor in Mail Merge

B

bhsmaths

G'Day,
I am fairly new to using word/excel within a VB project. Currently I have a
project which uses 3 Excel sheets to write an order form and save the data
in a fourth excel sheet. The program then opens a word document and
mail-merges this final excel sheet. Everything is working fine, but there is
one thing I would like to modify. Currently when I Mailmerge to the word
document the program displays an alert to confirm that I wish to use a
specific table (there is only one sheet to the excel file). How can I bypass
this requestor so that word automatically loads the table without alerts. I
have turned of DisplayAlerts with no difference. Thanks for any assistance.
Allan R Smyth (Australia)
 
C

Cindy M -WordMVP-

Hi Bhsmaths,
I am fairly new to using word/excel within a VB project. Currently I have a
project which uses 3 Excel sheets to write an order form and save the data
in a fourth excel sheet. The program then opens a word document and
mail-merges this final excel sheet. Everything is working fine, but there is
one thing I would like to modify. Currently when I Mailmerge to the word
document the program displays an alert to confirm that I wish to use a
specific table (there is only one sheet to the excel file). How can I bypass
this requestor so that word automatically loads the table without alerts. I
have turned of DisplayAlerts with no difference. Thanks for any assistance.
Version of Word? Can you describe this "requestor" in more detail?

I take it your code is opening the Word document; is it also attaching the data
source? It sounds as if this message could be appearing because your code isn't
providing all the necessary information for attaching the data source?

If that's the case, try recording a macro in Word that attaches the data
source, then transfer the result into your project. If you're still having
problems after that, copy the part of the code that deals with Word into your
reply (and don't forget the version, as that's extremely important for mail
merge questions).

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
B

bhsmaths

Thanks Cindy,
I am accessing my word document from within a VB6.0 Form. I am using a file
"orders.xls" as a mail merge source.The code I am using is

f$ = dirx & "/" & "orders.xls":Rem dirx is home directory and orders.xls is
the mailmerge source
appword.DisplayAlerts = wdAlertsNone:rem I hoped this would bypass the
requestor but it seems to have no effect
With wdoc.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource Name:=f$, _
ReadOnly:=True, _
Connection:="orders$"
End With
appword.DisplayAlerts = wdAlertsAll

Everything works as expected except a requestor pops up.

"Select Table".

This requestor has only one table "orders$" and as soon as I accept the
table ie click "OK", the mailmerge proceeds as required. How do I get it to
automatically accept this table and bypass the requestor. I have looked at
the VBA books in the local bookstores, but none cover Mailmerging from
within VB. The program has been written for teacher's assistant in the
science lab and needs to be kept as simple as possible (KISS).

Thank you again for your assistance.
Allan R Smyth
Mathematics department Blakehurst High School
 
C

Cindy M -WordMVP-

Hi Bhsmaths,

As I said, RECORD a macro in Word to get the necessary syntax. Providing only
the path and file name is usually not enough for Word 2003.
I am accessing my word document from within a VB6.0 Form. I am using a file
"orders.xls" as a mail merge source.The code I am using is

f$ = dirx & "/" & "orders.xls":Rem dirx is home directory and orders.xls is
the mailmerge source
appword.DisplayAlerts = wdAlertsNone:rem I hoped this would bypass the
requestor but it seems to have no effect
With wdoc.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource Name:=f$, _
ReadOnly:=True, _
Connection:="orders$"
End With
appword.DisplayAlerts = wdAlertsAll

Everything works as expected except a requestor pops up.

"Select Table".

This requestor has only one table "orders$" and as soon as I accept the
table ie click "OK", the mailmerge proceeds as required. How do I get it to
automatically accept this table and bypass the requestor. I have looked at
the VBA books in the local bookstores, but none cover Mailmerging from
within VB. The program has been written for teacher's assistant in the
science lab and needs to be kept as simple as possible (KISS).

Thank you again for your assistance.
Allan R Smyth
Mathematics department Blakehurst High School

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
B

bhsmaths

Hi Cindy,
I did not realise how useful the macro recorder was for assisting code
generation. Thank you for the advice.
Best wishes for the New Year.
Al S
 

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