Macro to convert HTML within a cell to a rich text formatted cell

lrussell5

New Member
Joined
Aug 19, 2013
Messages
11
I am trying to use the below macro to copy HTML into IE10 and paste back into excel in a rich text format

The error message is 'Run-time error '438' Object doesn't support this property or method.

When I debug it appears to be something wrong with the copy line?


Sub Sample()
Dim Ie As Object


Set Ie = CreateObject("InternetExplorer.Application")


With Ie
.Visible = False


.Navigate "about:blank"


.document.body.InnerHTML = Sheets("Sheet1").Range("A2").Value


.document.body.createtextrange.execCommand "Copy"
ActiveSheet.Paste Destination:=Sheets("Sheet1").Range("B2")


.Quit
End With
End Sub


Any help would be highly appreciated!
 

Some videos you may like

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

pbornemeier

Well-known Member
Joined
May 24, 2005
Messages
3,807
Google: web scraping vba site:mrexcel.com
to see a bunch of posts that discuss pulling data from IE to Excel
 

lrussell5

New Member
Joined
Aug 19, 2013
Messages
11
Hi Phil

Thanks for the suggestion, i'm not really trying to scrape data it's more just converting an excel cell containing HTML to a rich text format

e.g if cell a1 contained '< b > Happy < b >'

I want to convert that into cell b1 as 'happy'
 

Watch MrExcel Video

Forum statistics

Threads
1,098,873
Messages
5,465,211
Members
406,419
Latest member
ldp124

This Week's Hot Topics

Top