Hi

I am trying in export data to word and have used the following. This example below is to export the first line of an address (VARADD1). However it appears to generate and open the word template but is still not inserting the address line into the word template from excel.

Someone has told me I need to set the 'NumberOfWords' to make this work. I have tried to make something work (area highlighted red) but to no avail. The error message also states 'Object Required'.

Any help would be appreciated.

Sub OpenWord()

    Dim wdApp As Object
    Dim wdDoc As Object
    Set wdApp = CreateObject("Word.application")
    Set wdDoc = wdApp.Documents.Open _
      (FileName:="H:\Richard's Folder\HTB\MCR\Clt Ltrs\Client Issue Letter")
    wdApp.Visible = True
        Dim NumberOfWords, ThisWord As Integer
RecountWords:
    NumberOfWords = ClientIssueLetter.Words.Count
        For ThisWord = 1 To NumberOfWords
    Set OLRange = ClientIssueLetter.Words(ThisWord)
    If OLRange = VARADD1 Then OLRange.Text = Sheet1.Cells(2, 60).Value
    Next
    ' put your code here for working with Word
' This is Word VBA code, not Excel code
AllUpdated = True

End Sub