Calling MS Word Letter Wizard?

  • Thread starter Thread starter VMI
  • Start date Start date
V

VMI

How can I call the Microsoft Word Letter Wizard from within a C# Windows
application? And once I open the Letter Wizard from the application, can I
automatically paste text on one of the fields (specifically the Delivery
Address field in Recipient Info Tab)?

I'm using VS 2005 and MS Word 2002.

Thanks.
 
You need to create a COM reference to the MS Office Primary InterOp
Assemblies.

From there, you make an instance of the Word Application and away you go....

Don't forget to call Marshall.ReleaseComObject(comObjectReference) when you
are done with any COM instances you make.
 
Hi VMI,

Since the Letter Wizard is a template, after invoking it, you will not have
full control of the dialog to enter the delivery address. I think you can
use some GUI automation library to automate the operations. For example:
http://www.ranorex.com/

To learn how to invoke the Letter Wizard in C#, you need to first know
which object model is used in Word automation, you can first record a macro
in Word to get some idea. For example, following is the VBA code needed to
invoke the Letter Wizard:

Documents.Add Template:= "C:\Program Files\Microsoft
Office\Templates\1033\Letter Wizard.wiz", NewTemplate:=False,
DocumentType:=0


Hope this helps.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi VMI,

Have you seen my last reply? Please feel free to let me know if there's
anything unclear. Thanks.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top