View Single Post
 
Old 02-08-2024, 09:08 AM
Italophile Italophile is offline Windows 11 Office 2021
Expert
 
Join Date: Mar 2022
Posts: 341
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Try:

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")

    wdoc.SelectContentControlsByTitle("my_name_control").Item(1).Range.Text = "new text"

End Sub
Reply With Quote