Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-08-2024, 09:08 AM
Italophile Italophile is offline Change text in a Word content control with VBA in Excel Windows 11 Change text in a Word content control with VBA in Excel Office 2021
Expert
 
Join Date: Mar 2022
Posts: 554
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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change text in a Word content control with VBA in Excel Change Value of a Content Control based on the value of another content Control jsc_msoffice Word VBA 2 05-21-2021 09:51 PM
Copy Formatted Text in one Rich Text Content Control to another Rich Text Content Control Haygordon Word 1 04-05-2019 05:43 AM
Change text colour for content control labels? Toe Word 1 01-17-2019 08:45 AM
Change text in a Word content control with VBA in Excel Is there a way to anchor drop-down content control boxes so entering text doesn't change formatting? TzarChasm Word 7 04-14-2016 06:28 PM
Change text in a Word content control with VBA in Excel How to retrieve text from a word content control in VBA jeffaus Word VBA 1 03-14-2013 11:42 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft