Microsoft Word - Datasource not being released after an automated mail merge
Asked By Andrew Lockwood on 06-May-12 06:17 PM
I am pulling my hair out over this one!
I have written a macro which merges a Word template with a .csv file created in another program. The merge works fine, but the datasource file remains locked by Word, so I cannot create a new .csv file until I have closed all open documents in Word (not just the one I have created by the merge). This is a major headache when wanting to create multiple documents in succession.
Name:="d:\documents and settings\shared\word invoice.csv"
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
Any hints / suggestions as to why Word is keeping the datasource file locked would be much appreciated.