Word Automation and Outlook

D

Dan Perkins

I am working on a VB program that uses Automation with MS
Word. I am running into a rather confusing issue (it is
confusing both me and apparently VB).

It goes like this.

If you have Outlook open, and use Word as your e-mail
editor, then you have an instance of WINWORD.exe running.
However, this is not a full instance, and Automation does
not work with it.


What I want to do is
Dim Word as Object
Set Word = CreateObject("Word.Application")

Then I want to be able to select that instance of
WINWORD.exe and use it with the Automation for the rest of
my process.

How do I determine which WINWORD.exe process is being used.

Does any of this make sense?
 
J

Jezebel

If WinWord is started from another application (like Access) then the
start-up macros may be bypassed giving the impression that automation is not
working. However, the instance is still fully functional -- you can start
the automation manually if you need.

You can use GetObject() in place of CreateObject() to get a reference to an
existing instance of an application. But you don't have an easy way to
select *which* instance if there are multiple instances running.
 
P

Peter Hewett

Hi Jezebel

On my system at the moment GetObject is instantiating Word (no instance running)! It's
not my normal Office development system, it's my dot Net one. It's Windows 2000SP4 VS Net
2002, 2003 and Office XP.

I've no idea what's going on but an Office reinstall is on the cards!

Cheers - Peter


If WinWord is started from another application (like Access) then the
start-up macros may be bypassed giving the impression that automation is not
working. However, the instance is still fully functional -- you can start
the automation manually if you need.

You can use GetObject() in place of CreateObject() to get a reference to an
existing instance of an application. But you don't have an easy way to
select *which* instance if there are multiple instances running.

HTH + Cheers - Peter
 
J

Jezebel

Maybe XP is different (!?) -- but this has terrible implications for a lot
of code that relies on GetObject() functioning as documented. Bear in mind
the instance the GetObject() retrieves need not be visible.

Or, as you suggest, a corruption somewhere ... does the problem occur if you
use GetObject() with a non-Office apps?
 

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