Opening Word 2000 File

K

Kevin

Hi
I've this code to open a Word 2000, but this generate an error. I reference
to Microsoft Word 9.0 Object Library.

WordApp = new Word.ApplicationClass();
if(WordApp != null)
{
WordApp.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone;
WordDoc = WordApp.Documents.Open(ref DocFile, ref FalseParam, ref TrueParam,
ref FalseParam,
ref DocPassword, ref NullObject, ref NullObject, ref NullObject, ref
NullObject,
ref NullObject,ref NullObject, ref IsVisible);
if(WordDoc != null)
{
WordDoc.ActiveWindow.Selection.WholeStory(); // GENERATE ERROR >
NullReferenceException
WordText = WordDoc.ActiveWindow.Selection.Text;
}
}

The ActiveWindow property is null.

Whats wrong in this code?

Thanks :)
 
N

Nicholas Paldino [.NET/C# MVP]

Kevin,

If the app isn't visible at all, then how can any window be active?

Also, why would you assume there is a selection when you open the file?

What are you trying to do?
 

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