?
Solved

Error Activating Word Application

Posted on 2010-08-31
2
Medium Priority
?
1,056 Views
Last Modified: 2012-06-27
I have some code that will run on a server and will generate a word file, to be downloaded to the user.  Since it is running on a server, there is no good reason to have the Word application itself visible.  The trouble is that I cannot activate Word when I set visible to false.

The code below works fine.

When I comment out the line that says 'mswApp.Vislble = true", I get a COMError that it cannot activate the application.

Any idea why?  Why would it let me set the application to invisible if I cannot activate it once I do?

Thanks.



mswApp = new Microsoft.Office.Interop.Word.Application();
mswApp.Visible = false;
//
// Comment out the next line for production
//
mswApp.Visible = true;
mswApp.Activate();

Open in new window

0
Comment
Question by:TimAttaway
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 2000 total points
ID: 33569728
>>Any idea why?

Well activate gives it the focus - oops, it's hidden !!
0
 

Author Comment

by:TimAttaway
ID: 33570775
Ah!  I thought you had to activate the application before you could generate a document but in fact you don't.  Thanks.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question