Hi,
I'm trying to Mail Merge to a Word Document from VB.
I have a Word Template with Mail Merge Fields.
The problem I have is that I need to insert an HTML table into one of the Mail Merge Fields, however it fails whenever I try to input from the text file.
I intended to create some VB code to find a particular Mail Merge Field and Insert the HTML in there.
However I can not seem to get it to work.
Here is the code I'm using:

VB Code:
  1. Dim oApp As Word.Application
  2.     Dim oDoc As Word.Document
  3.  
  4.     On Error GoTo errHandler
  5.    
  6.     'Start a new document in Word
  7.     Set oApp = CreateObject("Word.Application")
  8.     Set oDoc = oApp.Documents.Open(s_Templates & TemplateFile)
  9.    
  10.    
  11.     With oDoc.MailMerge
  12.         .OpenDataSource Name:=s_TempFiles & "MergeData.txt" 'Specify your data source here
  13.         .Destination = wdSendToNewDocument
  14.        .Execute False
  15.     End With
  16.    
  17.  
  18.  
  19.     oDoc.Close False
  20.     oApp.Documents(1).SaveAs (s_Drive & Subject & ".doc")
  21.     oApp.Documents(1).Close
  22. ' Release references.
  23.   oApp.Quit
  24.   Set oDoc = Nothing
  25.   Set oApp = Nothing