Hi guys

I want to write code in Excel/VBA so that when print button is pressed then it merges the word document using data from a text file(Notepad file) and prints all the letters automatically. The following code doesn't work and gives command failed error. I hope anyone can help me in this.

Private Sub CommandButton1_Click()

Call Merge_snb
End Sub

Sub Merge_snb()
 strWorkbookName = "C:\Documents and Settings\WWW\desktop\RemLet.txt"
 With CreateObject("Word.Application").Documents.Add("C:\Documents and Settings\WWW\Desktop\Incomplete letter.doc").MailMerge
  .MainDocumentType = 0
  .Destination = 1
  .OpenDataSource _
            Name:=strWorkbookName, _
            AddToRecentFiles:=False, _
            Revert:=False, _
            Format:=wdOpenFormatAuto, _
            Connection:="Data Source=" & strWorkbookName & ";Mode=Read", _
            SQLStatement:="SELECT * FROM `C:\Documents and Settings\WWW\Desktop\RemLet.txt"
  .Execute
  '.Execute
  .Parent.Close 0
 End With
 MsgBox "The letters have been printed off"
End Sub