Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / April 2004

Tip: Looking for answers? Try searching our database.

Mailmerge and self defined function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob van Valkenburg - 14 Apr 2004 23:09 GMT
I want to do a WORD mailmerge linked to a Excel database.
Also I want to make a self defined function in Vba-editor module:

A simple example:
Function test (number1, number2)
test = number1 * number2
End Function

(number1 and number2  refer to fields in the Excel database)

How to make this function work in the document?
Doug Robbins - Word MVP - 15 Apr 2004 03:10 GMT
You can't.

Use another column in the database to contain the product of the number1 and
number2.

Why use Word as a calculator when you have a spreadsheet?

Signature

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested.  Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP

> I want to do a WORD mailmerge linked to a Excel database.
> Also I want to make a self defined function in Vba-editor module:
[quoted text clipped - 12 lines]
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.657 / Virus Database: 422 - Release Date: 13-4-2004
Peter Jamieson - 15 Apr 2004 10:40 GMT
In addition to Doug's response which describes the simplest solution, all
other things being equal,
a. if you are using Word 2002 or later you can use Word's Mailmerge events
to fire a VBA routine immediately before each record in the data source is
merged. You can use the event to insert the value you want in a number of
ways, e.g. by setting the value of a Document Variable and using a {
DOCVARIABLE } field in the document.
b. you may be able to "add columns" to your data source using an SQL SELECT
statement in an OpenDataSource routine (if you are getting your data from
Excel via ODBC or OLEDB)
c. you can use a DATABASE field in your main document to return the results
of Jet SQL functions, but you typically have to have an additional file to
do it.

Signature

Peter Jamieson - Word MVP
Word MVP web site http://word.mvps.org/

> I want to do a WORD mailmerge linked to a Excel database.
> Also I want to make a self defined function in Vba-editor module:
[quoted text clipped - 12 lines]
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.657 / Virus Database: 422 - Release Date: 13-4-2004
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.