views:

403

answers:

3

I need to start utilizing the interop in my programs to automate several functions in Word and Outlook and I was checking if anyone knew a good place to start. My ultimate goal is for my program to kick off a mail merge, create several different files and save them accordingly, then e-mail the different files to different people based upon who needs what. So any help on learning how to use the interop properly would be greatly appreciated.

I am currently using Visual Studio 2008 and Office 2007 and use vb.net to write my programs.

Thank you in advance.

+2  A: 

A good way to get started is to use the macro editor to record the steps you are trying to perform. You can take the generated macro code and modify it for your purposes to suit. Click on the names of functions and variables of which you do not know the purpose and hit "F1" to get context specific help.

1800 INFORMATION
A: 

You might want to start here: http://msdn.microsoft.com/en-us/office/bb266408.aspx.

There are a number of tutorials.

Rob
A: 

Add COM references to Outlook 12.0 Object library and Word 12.0 Object library.

This web page really helped kick me off: http://support.microsoft.com/kb/316383

Then, by recording macros you'll expose a lot of the stuff you'll likely want to work with. Word of warning, however, is that not everything exposed in VBA (macros) is accessible within VB .NET. I don't know why this is, but I've actually had to construct and execute a macro from VB.NET, written in VBA, within Excel to accomplish something that seemed ridiculously easy if it weren't for the strange disconnect between the two.

Some good info on Mail Merge: http://support.microsoft.com/kb/258512

Here's an article with some basic steps to get you up and connected with Outlook's Interop: http://support.microsoft.com/kb/313787

Hope this helps. I'll keep an eye out for questions from you here--I'd say I know quite a bit when it comes to interop.

Tychumsempir