I am automating a Word mail merge using VB.NET, VSTO. I have a field coded Word Document. I am using code like this to merge another word document into the field coded Word document. This works fine for Word documents.
Dim range As Word.Range = Nothing
Dim fWd As Word.Field = Nothing
Dim strFieldName as string = "ImprovementData"
Dim strFilePath as string = "c:\someplace\somewhere.doc"
For Each fWd In oDoc.Fields
If fWd.Code.Text.IndexOf(" " & strFieldName & " ") <> -1 Then
range = fWd.Result
I also need to merge Excel spreadsheets into the same field coded document. This does not work for Excel. How can I merge the spreadsheet into the word document. I am limited to using field codes. Cannot use bookmarks. The Word Document being merged into is a Field Coded template that is used over and over. The document is actually populated from data from an Access database along with the merged Word and EXCEL files. I cannot imbed macros in the Word template or in the EXCEL files. Have to do it with VB.NET in VSTO.