Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now
Private Function FindReplaceAnywhere(strFind As String, sReplace As String, Optional iMode As Integer = 0) Dim rngStoryType As Word.Range Dim rngCurrentStory As Word.Range ' Go through all story ranges in the document, including shapes, headers, footers, text boxes footnotes ' headers & footers. For Each rngStoryType In ActiveDocument.StoryRanges Set rngCurrentStory = rngStoryType 'set rngCurrentStory to first range in story Do FindAndReplaceInRange rngCurrentStory, strFind, sReplace, iMode Set rngCurrentStory = rngCurrentStory.NextStoryRange Loop Until rngCurrentStory Is Nothing Next rngStoryType End Function Private Sub FindAndReplaceInRange(rng As Word.Range, strFind As String, sReplace As String, Optional iMode As Integer = 0) With rng.Find .Text = strFind With .Replacement .ClearFormatting .Text = sReplace End With If iMode = 1 Then .Execute Replace:=Word.WdReplace.wdReplaceOne Else .Execute Replace:=Word.WdReplace.wdReplaceAll End If End With End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|How to open Microsoft Word 2013 in edit mode from the server||16||97|
|How to remove duplicates eficiently without sorting||5||57|
|Auto save MS Word - shortest intervals||10||24|
|Email Excel WB by selecting name from a dropdown list to Outlook.||5||46|
Join the community of 500,000 technology professionals and ask your questions.