This may be too late to help you, but if the html is not too involved I have a macro that can do the trick. But, I feel I need to explain why it's so involved.
The < and > used in html tags are also used as wildcard characters in Word for the beginning and ending of a word. You need to be able to search using wildcards so that the commands you're looking for can be any length.
So, what the macro does is without using wildcards, replaces < with ~~ (or any other character that isn't a wildcard in Word. And replace all the >'s with || or anyother character that isn't a wildcard. Then to remove all the tags, replace using wildcards all instances of ~~*|| with nothing.
Now just in case your text has legit < or > that are not part of a tag: You then replace without using wildcards all instances of ~~ with < and || with >. Below is a macro that does this:
Sub Macro1()
Selection.HomeKey Unit:=wdStory 'Go to the top of the document
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find 'replace < with ~~
.Text = "<"
.Replacement.Text = "~~"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find 'replace > with ||
.Text = ">"
.Replacement.Text = "||"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find 'erase using wildcards the string ~~*||
.Text = "~~*||"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find 'Put all ~~ not in a tag back to <
.Text = "~~"
.Replacement.Text = "<"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find 'Put all || not in a tag back to >
.Text = "||"
.Replacement.Text = ">"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
>Hello,
>
>I have a foxpro table that I would like to use to create a mail merge document from. The problem that I am running into is that some of the fields in the table contain html and word does not conver the html to formatted text. Any ideas?
>
>Thanks
___________________________
Kenneth Wonderley
http://www.wonderley.com...the fruit of the Spirit is love, joy, peace, patience, kindness, goodness, faithfulness, gentleness and self-control.
Galatians 5:22 & 23