Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I get HTML codes in an Excel Spreadsheet to display or conv
Hi folks, Thanks for taking the time to look and help out!
I have data coming from an SQL db and some of the fields of my report have been formatted via VBA to do things like convert email strings into actual email links, and some of the data is just plain text. My problem is that one of the fields has imbedded HTML codes that were created by the original app and stored within that field in the SQL db. Only some of the records have the formatting but when they do, it is typically for text formatting, but occassionally to imbed links. I need to have Excel interpret these HTML codes in this one field back to the text formatting and links that they represent. Here is an example: <html<bodyFolder to contain requirments <brejected</b because they are duplicates.</body</html How to I get Excel 2003 (or 2007 if necessary) to convert the HTML? If it can be "converted", can Excel interpret or view the HTML? If not, can it be stripped out? Thanks in advance for your ideas! |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
How do I get HTML codes in an Excel Spreadsheet to display or conv
I don't know of any kind of translator, but a little bit of VB code could
help you strip out the HTML code. Try inserting this into a module (change the range ("D21:D50") and sheet name ("Sheet1") to what you need, of course). It can also be made more flexible to be a function to handle whatever range you want. Sub RemoveHTML() Dim rngCell As Range Dim strInput, strOutput As String Dim i As Integer Dim bSkipCapture As Boolean Sheets("Sheet1").Select For Each rngCell In Range("D22:D50") If Len(rngCell) 0 Then strInput = rngCell.Value For i = 1 To Len(strInput) If Mid(strInput, i, 1) = "<" Then bSkipCapture = True If Not bSkipCapture Then strOutput = strOutput + Mid(strInput, i, 1) End If If Mid(strInput, i, 1) = "" Then bSkipCapture = False Next rngCell = strOutput strOutput = "" End If Next End Sub -- Happy calculating! If you like this answer, please click ''Yes.'' "scottydm3" wrote: Hi folks, Thanks for taking the time to look and help out! I have data coming from an SQL db and some of the fields of my report have been formatted via VBA to do things like convert email strings into actual email links, and some of the data is just plain text. My problem is that one of the fields has imbedded HTML codes that were created by the original app and stored within that field in the SQL db. Only some of the records have the formatting but when they do, it is typically for text formatting, but occassionally to imbed links. I need to have Excel interpret these HTML codes in this one field back to the text formatting and links that they represent. Here is an example: <html<bodyFolder to contain requirments <brejected</b because they are duplicates.</body</html How to I get Excel 2003 (or 2007 if necessary) to convert the HTML? If it can be "converted", can Excel interpret or view the HTML? If not, can it be stripped out? Thanks in advance for your ideas! |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
RESOLVED How do I get HTML codes in an Excel Spreadsheet to di
Well, that's pretty straight forward. This worked! Thank you VERY MUCH for
your help! "GSnyder" wrote: I don't know of any kind of translator, but a little bit of VB code could help you strip out the HTML code. Try inserting this into a module (change the range ("D21:D50") and sheet name ("Sheet1") to what you need, of course). It can also be made more flexible to be a function to handle whatever range you want. Sub RemoveHTML() Dim rngCell As Range Dim strInput, strOutput As String Dim i As Integer Dim bSkipCapture As Boolean Sheets("Sheet1").Select For Each rngCell In Range("D22:D50") If Len(rngCell) 0 Then strInput = rngCell.Value For i = 1 To Len(strInput) If Mid(strInput, i, 1) = "<" Then bSkipCapture = True If Not bSkipCapture Then strOutput = strOutput + Mid(strInput, i, 1) End If If Mid(strInput, i, 1) = "" Then bSkipCapture = False Next rngCell = strOutput strOutput = "" End If Next End Sub -- Happy calculating! If you like this answer, please click ''Yes.'' "scottydm3" wrote: Hi folks, Thanks for taking the time to look and help out! I have data coming from an SQL db and some of the fields of my report have been formatted via VBA to do things like convert email strings into actual email links, and some of the data is just plain text. My problem is that one of the fields has imbedded HTML codes that were created by the original app and stored within that field in the SQL db. Only some of the records have the formatting but when they do, it is typically for text formatting, but occassionally to imbed links. I need to have Excel interpret these HTML codes in this one field back to the text formatting and links that they represent. Here is an example: <html<bodyFolder to contain requirments <brejected</b because they are duplicates.</body</html How to I get Excel 2003 (or 2007 if necessary) to convert the HTML? If it can be "converted", can Excel interpret or view the HTML? If not, can it be stripped out? Thanks in advance for your ideas! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can excel display HTML in cells | Excel Discussion (Misc queries) | |||
Excel/XML DDE live data display in HTML | Excel Discussion (Misc queries) | |||
how do you drop an HTML spreadsheet into excel | Excel Worksheet Functions | |||
codes to display description | Excel Discussion (Misc queries) | |||
How can I make Excel display HTML code as text | Excel Discussion (Misc queries) |