How do I convert HTML tags within cell to text?

D

Datraveller

I have an XLS extract from a system that has included the HTML tags within
the cell. How do I go about converting this to text where possible and
removing it where not?
 
T

Tim Williams

You could try something like this. Modify to suit.

Need to add a project reference to "Microsoft HTML Object Library"

Tim

'**************************
Option Explicit

Sub Tester()
Dim c As Range
Dim oDoc As HTMLDocument
Set oDoc = New HTMLDocument

For Each c In Selection

oDoc.body.innerHTML = c.Value
c.Offset(0, 1).Value = oDoc.body.innerText

Next c


End Sub
'******************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top