' First add the mail merged fields and save the document 'Then reopen the word document and click no to SQL import and open VBA editor and paste this script 'Finally save this as a macro enabled document and test this code 'Happy coding Option Explicit Dim FOLDER_SAVED As String Dim SOURCE_FILE_PATH As String Function ReplaceIllegalCharacters(strIn As String, strChar As String) As String Dim strSpecialChars As String Dim i As Long strSpecialChars = "~""#%&*:<>?{|}/\[]" & Chr(10) & Chr(13) For i = 1 To Len(strSpecialChars) strIn = Replace(strIn, Mid$(strSpecialChars, i, 1), strChar) Next ReplaceIllegalCharacters = strIn End Function Sub TestRun() Dim MainDoc As Document, TargetDoc As Document Dim dbPath As String, FileName As String, Folder As String Dim recordNumber As Long, totalRecord As Long, startingRec As Integer, endingIndex As Integer Dim Answer As VbM...
We bring out what you mostly needed......