Solved

Error Activating Word Application

Posted on 2010-08-31
2
1,050 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 500 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

707 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