Word 2007 Automation issue on Vista

S

Scott McBurney

I have an application that we have used for years that uses the Word object
model. It exports data from another application, opens a mail merge document
in word, associates that document to the exported data source, and executes
the mail merge.

This worked great previously.

The problem we are seeing happens on Windows Vista with Office 2007. The
application still does everything right, but the Word window appears behind
our application window. With all previous versions of word (and the OS),
when Word was started using the Object Model, the Word application window was
always in the foreground.

So our application runs full screen, and now word appears behind it, the
user doesn't see word. They are lucky if they notice the blinking button on
the task bar for word.

Any suggestions how to get word to the foreground when it is launched using
its object model from another application?
 
M

MikeBarta

Scott,

I am having a very similar problem with Word automation on Vista.
Occasionally it will open in the foreground, and other times in the
background. This is really confusing for our users.

I have not found a solution yet, have you found anything? Our application
is in VB.Net 2005, I have tried all of the samples I can find on the MSDN
site for using Word, all with intermittent results.

-Mike Barta
 
S

Scott McBurney

I haven't found a solution to this issue. And obviously no one from
Microsoft has read this post. I thought the Microsoft MVPs were supposed to
respond to messages in these newsgroups? If not, what is the real purpose of
having them?
 
S

Steve Rindsberg

Scott McBurney said:
I haven't found a solution to this issue. And obviously no one from
Microsoft has read this post. I thought the Microsoft MVPs were supposed to
respond to messages in these newsgroups? If not, what is the real purpose of
having them?

The MVPs are volunteers, not MS employees, but certainly other people can and do
respond to questions here ... if they happen to know the answer. That's the
real purpose of having these newsgroups.

If nobody knows the answer or has any ideas that they want to follow up with
you, then you won't get a response.

Some of the newsgroups are for "managed" support. I'm not entirely certain how
it works, but if you have a support agreement with MS and have registered the
name you posted under with them, an MS support rep is supposed to respond to
questions w/in a certain period of time.

I believe this particular newsgroup is one such. If you have a support
contract, it should outline what services to expect and what you need to do to
receive them.

Hope that helps ...
 
S

Scott McBurney

Well, here is what is on the MSDN web site about the "managed newsgroups":

"MSDN managed newsgroups are available in English to MSDN Universal,
Enterprise, Professional, and Operating Systems subscribers to receive free
technical support on select Microsoft technologies as well as to share ideas
with other subscribers."

And I am a MSDN Universal subscriber (in fact, I think my company has at
least 50 universal subscriptions), and I'm posting via the MSDN Managed
Newsgroups web interface. But for the last year, pretty much anything I post
gets absolutely no response. Microsoft's statement of "free technical
support" via the managed newsgroups seems to have been long forgotten.
 
J

John Creviston

We are having the same problem.

We have a .NET mail merge application that automates word and it has worked fine for Word 2000, Word 2003, Word 2007 on XP and Win2000. When we try on Vista the Word application window does not come to the front. We use the standard automation commands:

Word Application.Activate
Word Application.Visible = true

Everything else about the application works fine except for Word not coming in front of our controlling application window. The problem only happens in Vista.

This is a commercial application that we are basically F$*&^# with under Vista and Word 2007.

It looks like Microsoft is laying low on this one.

EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
S

Steve Rindsberg

Scott McBurney said:
Well, here is what is on the MSDN web site about the "managed newsgroups":

"MSDN managed newsgroups are available in English to MSDN Universal,
Enterprise, Professional, and Operating Systems subscribers to receive free
technical support on select Microsoft technologies as well as to share ideas
with other subscribers."

And I am a MSDN Universal subscriber (in fact, I think my company has at
least 50 universal subscriptions), and I'm posting via the MSDN Managed
Newsgroups web interface. But for the last year, pretty much anything I post
gets absolutely no response. Microsoft's statement of "free technical
support" via the managed newsgroups seems to have been long forgotten.

Not entirely, as we do see regular posts from MS tech support folks, but it
doesn't seem right that your posts are not getting attention.

You might want to look for one of the posts from Jialiang Ge, for example, and
ask why you're getting so little help.
 
S

Steve Rindsberg

We are having the same problem.

We have a .NET mail merge application that automates word and it has worked fine for Word 2000, Word 2003, Word 2007 on XP and Win2000. When we try on Vista the Word application window does not come to the front. We use the standard automation commands:

Word Application.Activate
Word Application.Visible = true

Everything else about the application works fine except for Word not coming in front of our controlling application window. The problem only happens in Vista.

This is a commercial application that we are basically F$*&^# with under Vista and Word 2007.

It looks like Microsoft is laying low on this one.

There are API calls (at least in earlier Win versions) that allow you to bring a window to the top.
I wonder if something like that would solve your problem under Vista?
 
S

Scott McBurney

I looked into something like that. However, there seems to be no way to get
the window handle for the MS Word window. If we could get the window handle
from the object model, then it would be fairly easy to bring it to the
foreground.
 
S

Steve Rindsberg

Scott McBurney said:
I looked into something like that. However, there seems to be no way to get
the window handle for the MS Word window. If we could get the window handle
from the object model, then it would be fairly easy to bring it to the
foreground.

FindWindow is one approach (though it's possible it doesn't work in Vista)

IIRC, it takes the classname of the form or the form's caption and returns a
handle to the window.

This may help too:
http://vbnet.mvps.org/index.html?code/system/findwindowlikesimple.htm
 
R

robpinion

I have the problem on XP and Word 2002/2003. I'm generating the Word
window from Notes, and while it appears on top (after I set it
Visible=true), it is not the active window. If someone knows how to
bring it to the top, I would appreciate knowing.
 
L

law guy.

This is just a thought: is it possible that the problem is based on .net WPF?

I was messing around with WPF a few months back and recall that window apps
were layered according to an xaml. So, there may be a default xaml
associated with Word 2007 being read via the .net WPF. This may have a
default layering scheme that is enforced unless overridden.

This would explain problems with Vista and any recently upgraded XPs. WPF
is a recent addition to the .net platform I believe.

Again, these are all guesses... I have nothing definite to show. But
figured I'd bring it up since no one else has discussed it.
 

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