word automation problem
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 开发者_如何学Cmissing);
Word.Selection selection = wordApp.Selection
Any ideas on how what I am missing here. Why is wordApp.Selection getting set as null.?
Thanks.
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.
精彩评论