Very tricky problem

P

Peter

Hi folks

I am writing a VB6 application that needs to access Word in order to open a file, create a table insert some fields and run a mail-merge (all through VB code). When setting a reference to the Word 10.0 object library it is easy to do all of this. However I am hoping to install the application on other users' computers which may have different versions of Word (and therefore different Word object libraries). I would therefore prefer to define my variables as Object and set them to the different Word objects without needing to set a reference to a specific Word object library, so that they can call on the existing Word Object library on the user's computer. Everything works fine EXCEPT a mail merge setting that relates to where the mail merge will be executed to

mailmerge.Destination=wbSendToPrinte

mailmerge.Destination=wbSendToDocumen

If I try to run the program without setting a reference to the Word Object library an error is generated that will not recognise the above 2 enums (wbSendToPrinter,wbSendToDocument)

Anyone know how to fix this?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?UGV0ZXI=?=,
mailmerge.Destination=wbSendToPrinter

mailmerge.Destination=wbSendToDocument

If I try to run the program without setting a reference to the Word Object library an
error is generated that will not recognise the above 2 enums
(wbSendToPrinter,wbSendToDocument).Enums represent LONG values. If you don't use the object library (IOW you have "late
binding") then you have to use the values rather than the ENUM representations.

Go into the Object Browser in Word's VB Editor (press F2). Type one of the ENUM constants
into the "Find" box, then click the binocular-button. You should get a list of wdSendTo
Enums. Click on one, then look at the bottom of the window to see the value.

OR, you can type ?wdSendToPrinter then press Enter in the "Immediate Window" to get the
value.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
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 :)
 

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