Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MAILMERGE WORD DATASOURCE MOVEMENT

Status
Not open for further replies.

vladob

Programmer
Mar 21, 2004
4
CZ
Hi all,

I have just installed Word 2003 and have to say that if the solution for my question below not found I will uninstall it.

I use many macros to generat series of documents.

I would like to know how to cycle though the mailmerge datasource and how to detect the endof cycle.

Normally when I use mailmerge.datasource.activerecord=wdnextrecord it moves the recordpointer in datasource to next record.

But when I issue the command on the last record, it does not announce any error.

If I try to issue mailmerge.datasource.activerecord=wdlastrecord the recordpointer is not changed.

How I can than loop though all the records in datasource?


Many thanks

Vladimir
 
How I can than loop though all the records in datasource?
With ActiveDocument.MailMerge.DataSource
.ActiveRecord = wdFirstRecord
Do
'Your stuff here
If .ActiveRecord <> .RecordCount Then
.ActiveRecord = wdNextRecord
End If
Loop Until .ActiveRecord = .RecordCount
End With

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Hi,

thanks for your input. Unfortunatelly my data source is not simple excel table or word table, but it is datasource of Visual FoxPro free table to which I connect. When I start document requesting this connection WORD asks me whether I want to execute some SQL command and enter data into database. I must say yes. This is something new in Word 2003.

referencing property .recordcount did not help me as for question "? activedocument.mailmerge.datasource.recordcount" I received answer like 3586957864 (actually I have only 23 record).

Any other help?

THanks a lot

V.
 
Just a thought.
What happens if you check the "Confirm conversion on open" in the General tab of Options (Menu Tools -> Options...)

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
And what about an excel spreadsheet making the query and word taking this .xls as datasource ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Maybe it works, but this kind of data connection worked with word 2002 and I wonder why it does not work with 2003?

V.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top