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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Google: web scraping vba site:mrexcel.com
to see a bunch of posts that discuss pulling data from IE to Excel
 
Upvote 0
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'
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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
Back
Top