Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 02-17-2022, 01:31 AM
gmayor's Avatar
gmayor gmayor is offline Replace String Windows 10 Replace String Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

It would be simpler just to replace 'sample' with 'Sample' in the first cell of each table e.g.
Code:
Sub Macro1()
Dim oTable As Table
Dim oCell As Range
    For Each oTable In ActiveDocument.Tables
        Set oCell = oTable.Cell(1, 1).Range
        oCell.Text = Replace(oCell.Text, "sample", "Sample")
    Next oTable
    Set oCell = Nothing
    Set oTable = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Tags
find, replace



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I replace string 123-4 with 123 4 davidjm Word VBA 25 11-03-2021 02:40 PM
Replace String Replace characters in a string Marcia Excel Programming 5 05-04-2020 05:15 AM
Replace String Wildcard replace any string in context with a specified string wardw Word 7 05-07-2018 09:13 AM
Replace String Replace characters in a string Anthon Excel Programming 1 11-03-2016 12:48 AM
Replace String Find and replace a string of text errtu Word 1 01-31-2013 02:09 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:04 AM.


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