Error when creating an instance of Word in VB.net
问题 I am getting an error when I run this app in VS 2010 (it works fine in VS 2008) Private Sub GenerateInvoice() Dim emptyObject As Object = System.Reflection.Missing.Value Dim wordApp As New Word.Application wordApp.Visible = True Dim InvoiceDoc As New Word.Document InvoiceDoc = wordApp.Documents.Add(InvoicePath, emptyObject, emptyObject, emptyObject) Dim totalFields As Integer = 0 For Each mergeField As Word.Field In InvoiceDoc.Fields The error occurs at the For Each line "Object reference not