Hi,
I have data in a Excel sheet and a macro.
When i run the macro i want to populate with some data, in this excel, to a Word document.
I bookmark the content control in Word.
My approach:
Code:
Sub ReplaceText()
Dim wApp As Word.Application
Dim wdoc As Word.document
Set wApp = CreateObject("Word.Application")
wApp.Visible = True
Set wdoc = wApp.Documents.Open(ActiveWorkbook.Path & "\teste.docx")
Dim control As ContentControl
Set control = ActiveDocument.SelectContentControlsByTitle("my_name_control").Item(1).Range.Text = newtext
End Sub
I read some post in the forum but cant put this working.
Could some one give a hint?
Thanks