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!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

pbornemeier

Well-known Member
Joined
May 24, 2005
Messages
3,890
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,130,169
Messages
5,640,550
Members
417,151
Latest member
ChickenTenderer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top