Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-05-2013, 07:44 AM
String String is offline Trying to wrap HTML tags around multiple different words in one operation Windows XP Trying to wrap HTML tags around multiple different words in one operation Office 2007
Novice
Trying to wrap HTML tags around multiple different words in one operation
 
Join Date: Jun 2013
Posts: 3
String is on a distinguished road
Default

Sure,



This is the macro code I am using to highlight each separate word. Its a very lightly modified code I found on these forums.

Code:
Sub HiLightList()
Application.ScreenUpdating = False
Dim StrFnd As String, Rng As Range, i As Long
StrFnd = "yellow,green,dog,horse"
For i = 0 To UBound(Split(StrFnd, ","))
  Set Rng = ActiveDocument.Range
  With Rng.Find
    .ClearFormatting
    .Text = Split(StrFnd, ",")(i)
    .Replacement.ClearFormatting
    .Replacement.Highlight = True
    .Replacement.Text = "^&"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = True
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute Replace:=wdReplaceAll
  End With
Next
Set Rng = Nothing
Application.ScreenUpdating = True
End Sub
So once its found and highlighted these words, I need it to wrap an HTML tag around them all.

Thx
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to wrap HTML tags around multiple different words in one operation Highlight and then replace multiple words redhin Word VBA 5 03-05-2013 05:42 AM
Trying to wrap HTML tags around multiple different words in one operation Create and populate multiple templates with merge tags jelarbey Word 1 10-09-2012 05:20 AM
Trying to wrap HTML tags around multiple different words in one operation How can I count multiple usage of the same words? coffee_king Word VBA 1 03-24-2012 07:52 PM
Attaching MSG file is stripped on send and HTML tags show on previewing prior to send Fantastic4 Outlook 0 01-09-2012 12:18 PM
Trying to wrap HTML tags around multiple different words in one operation Making Multiple Words Bold mtk989 Word 2 06-25-2011 11:27 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:47 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