views:

24

answers:

1

I am trying open a word document for manipulation. However in the code below 'wordApp.Selection' is always null

object missing = System.Reflection.Missing.Value;
 Word._Application wordApp = new Word.Application();
Word._Document aDoc =wordApp.Documents.Open(ref fPath1, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);

Word.Selection selection = wordApp.Selection

Any ideas on how what I am missing here. Why is wordApp.Selection getting set as null.?

Thanks.

A: 

I believe that you have to set the selection before it will have a value -- when you open a document in Word, it does not automatically select the entire document, you would have to do that programmatically before Selection has a value.

Dr Herbie
how? I cant see any examples anywhere that explain that.