I have a Word 2013 document (.docx) with values I need replacing. I can find plenty of code but can't get it to work as the imports word.application doesn't work.
My form has a text box to specify the filename of the word document and a text box for the user to put a value into (tbCRMID). Once I execute I need the value in the word document ( to be replaced with tbCRMID.text).
I have a host of other replacements to do but once I get one working, I should be all set.
Here is my code:
Try
Dim NewOutputFile As String
Dim newApp As Object
Dim newDoc As Object
newApp = CreateObject("Word.Applicatoin")
newApp.visible = True
Catch ex As Exception
MsgBox(ex.Message)
End Try
This code generates the error "Cannot create Active X control"
.