Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find formatting in text in cell, insert tags aroundformatting

Hi, I just read this interesting topic, as we are looking for this for months... So, I tried to do this but don't know where to start? Is this info regarding a macro? Where do I need to add this formula?

grtz

K.

EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Find formatting in text in cell, insert tags around formatting

What "interesting topic"? Your message is the only one in this thread. Why
don't you tell us what you are trying to do (in some detail please) and
let's see if someone here can give you code to do it.

--
Rick (MVP - Excel)


"Kris Gevers" wrote in message ...
Hi, I just read this interesting topic, as we are looking for this for
months... So, I tried to do this but don't know where to start? Is this
info regarding a macro? Where do I need to add this formula?

grtz

K.

EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find formatting in text in cell, insert tags around formatting

This is very nice macro, but not a solution for serious documents (about 120000 cells). Is it possible to do this using MSExcel directly without Vba?

On Wednesday, February 27, 2008 1:58 PM Carl wrote:


Hi,

I have cells containing bold or italic words within the text. I would like
to be able to search for the various formatting within the cells, insert tags
around the formatted words, and then remove the formatting.

The tags look like: <emph render="name of formatting"formatted words</emph

Example:
Suppose the words "quick brown" were in bold, the text should look like:
"The <emph render="bold"quick brown</emph fox jumps over..."

Is there an easy way to search for formatting within a cell and identify the
formatted words so that the tags can be inserted?

Thank
-Carl



On Wednesday, February 27, 2008 3:50 PM Rick Rothstein \(MVP - VB\) wrote:


Give the subroutine after my signature a try. To use it, simply call it
while passing in the cell reference of the text you want to parse; something
like this...

ParseTxt ActiveSheet.Range("A1")

Note that this code will handle one font style embedded within another; so,
you can have a word that is both bold and italic; or your can have a bold
word embedded within a longer, italicized piece of text (or vice versa).

Rick

Sub ParseTxt(Cel As Range)
Dim X As Long
Dim Txt As String
Dim BoldOn As Boolean
Dim ItalicsOn As Boolean
If Cel.Count < 1 Then Exit Sub
For X = 1 To Len(Cel.Value)
If Cel.Characters(X, 1).Font.Italic And Not ItalicsOn Then
ItalicsOn = True
Txt = Txt & "<emph render=""italic"""
End If
If Cel.Characters(X, 1).Font.Bold And Not BoldOn Then
BoldOn = True
Txt = Txt & "<emph render=""bold"""
End If
Txt = Txt & Mid$(Cel.Value, X, 1)
If Not Cel.Characters(X, 1).Font.Bold And BoldOn Then
BoldOn = False
Txt = Left(Txt, Len(Txt) - 1) & "</emph" & Right(Txt, 1)
End If
If Not Cel.Characters(X, 1).Font.Italic And ItalicsOn Then
ItalicsOn = False
Txt = Left(Txt, Len(Txt) - 1) & "</emph" & Right(Txt, 1)
End If
Next
If BoldOn Then
Txt = Txt & "</emph"
End If
If ItalicsOn Then
Txt = Txt & "</emph"
End If
Cel.Font.Italic = False
Cel.Font.Bold = False
Cel.Value = Txt
End Sub



"CarlC" wrote in message
...



On Wednesday, February 27, 2008 4:26 PM Carl wrote:


Thanks!! Works like a charm.

-Carl


"Rick Rothstein (MVP - VB)" wrote:



On Monday, January 05, 2009 7:33 AM Kris Gevers wrote:


Hi, I just read this interesting topic, as we are looking for this for months... So, I tried to do this but don't know where to start? Is this info regarding a macro? Where do I need to add this formula?



grtz



K.



Submitted via EggHeadCafe
ASP.NET Base64 Image Encoding via the Data: protocol
http://www.eggheadcafe.com/tutorials...-protocol.aspx

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
How to find the custom xml tags in a workbook Cyril Excel Worksheet Functions 0 April 28th 10 05:53 AM
How do I convert HTML tags within cell to text? Datraveller Excel Programming 0 April 16th 08 05:02 PM
Find formatting in text in cell, insert tags around formatting. CarlC Excel Programming 2 February 27th 08 09:26 PM
Find Text the Insert Sum RyanH Excel Programming 5 January 23rd 08 04:08 PM
find text then insert new row above Nick Smith[_2_] Excel Programming 9 May 4th 06 12:59 PM


All times are GMT +1. The time now is 08:15 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"