Solved

Error Activating Word Application

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

919 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now