У вас много повторяющихся кодов, которые должны быть в отдельной подпрограмме.
Например:
Sub createPDF()
Dim objWord As Object, doc As Object
Dim ws As Worksheet
Dim theString As String
Dim TheFileName As String, nm, i As Long
Dim TemplatePath As String, myExtension, myfile
Dim Pscope As String
Set ws = ThisWorkbook.ActiveSheet
TemplatePath = ThisWorkbook.Path
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
myExtension = "*.doc*"
myfile = Dir(TemplatePath + "\Template" & "\" & myExtension)
Do While myfile <> ""
Set doc = objWord.Documents.Open(TemplatePath + "\Template" & "\" & myfile)
For Each nm In Array("company_ename", "owner_fname1", "owner_pname1", _
"owner_fullname1", "owner_id1", "owner_allotted1", _
"house", "director_pname1", "director_fname1")
DoReplace doc, ws, nm
Next nm
For i = 2 To 4
For Each nm In Array("owner_fname", "owner_pname", "owner_fullname", _
"owner_id", "owner_allotted")
DoReplace doc, ws, nm & CStr(i)
Next nm
Next i
TheFileName = TemplatePath & "\Output\" & ws.Range("company_ename").Value & _
"_" & Replace(myfile, "docx", "") & ".docx"
doc.SaveAs TheFileName
doc.Close savechanges:=False
myfile = Dir
Loop
Set objWord = Nothing
MsgBox "Generation Complete!"
End Sub
Sub DoReplace(doc As Object, ws As Worksheet, txt)
With doc.Content.Find
.Text = "{" & txt & "}" 'in the Word doc the tag is enclosed in{}
.MatchCase = False
.MatchWholeWord = True
.replacement.Text = ws.Range(txt).Value
.wrap = 1 'wdfindcontinue
.Execute Replace:=2 'wdReplaceAll
End With
End Sub