Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50273

Format Cell to display HTML code as formatted text

$
0
0
Hi all, new to this forum and spend couple of hours digging for this but cant seem to find the right resolution.

I am trying to convert the following HTML content that is displayed within a merged cell (A1-I1):

"<OL> <LI>If i modify the filter to show only Smartphones in the device list view, I should only see the appropriate access fee cost for Smartphones.</LI> <LI>If i modify the filter to show only Basic phones in the device list view, I should only see the appropriate access fee cost for Basic phones.</LI> <LI>If i modify the filter to show Smartphones and Basic phones&nbsp;in the device list view, I should only see the appropriate access fee cost for Smartphones and Basic phones.</LI> <LI>A "close" CTA is available for me to close the Information Banner.</LI></OL><BR>"

So that it looks like this in the merged cell:

1. If i modify the filter to show only Smartphones in the device list view, I should only see the appropriate access fee cost for Smartphones.
2. If i modify the filter to show only Basic phones in the device list view, I should only see the appropriate access fee cost for Basic phones.
3. If i modify the filter to show Smartphones and Basic phones in the device list view, I should only see the appropriate access fee cost for Smartphones and Basic phones.
4. A "close" CTA is available for me to close the Information Banner.

This works if content is only in cell A1 but then copies to 4 rows.

Code:

Sub Sample()
    Dim Ie As Object

    Set Ie = CreateObject("InternetExplorer.Application")

    With Ie
        .Visible = False

        .Navigate "about:blank"

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

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

        .Quit
    End With
End Sub


Viewing all articles
Browse latest Browse all 50273

Latest Images

Trending Articles



Latest Images