Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 33
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can excel display HTML in cells AdamWaller Excel Discussion (Misc queries) 2 December 18th 06 03:56 PM
Excel/XML DDE live data display in HTML lss Excel Discussion (Misc queries) 0 October 2nd 06 05:10 PM
how do you drop an HTML spreadsheet into excel Luddist Excel Worksheet Functions 0 September 13th 06 01:07 AM
codes to display description ernie Excel Discussion (Misc queries) 9 February 14th 06 12:24 AM
How can I make Excel display HTML code as text roopytoopdongle Excel Discussion (Misc queries) 1 March 20th 05 06:40 AM


All times are GMT +1. The time now is 07:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"