Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 113
Default html tags with a cell

I thought I could use html tags within a cell to bold
cetain words etc. such as My name is <BDan<b and I
want to be bold but it does not work.
  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default html tags with a cell

I never did post a question with this statement - is
there a way to format a part of a cell?



-----Original Message-----
I thought I could use html tags within a cell to bold
cetain words etc. such as My name is <BDan<b and I
want to be bold but it does not work.
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default html tags with a cell

Characters Property Example

This example formats the third character in cell A1 on Sheet1 as bold.

With Worksheets("Sheet1").Range("A1")
.Value = "abcdefg"
.Characters(3, 1).Font.Bold = True
End With
--

John

johnf202 at hotmail dot com


wrote in message
...
I never did post a question with this statement - is
there a way to format a part of a cell?



-----Original Message-----
I thought I could use html tags within a cell to bold
cetain words etc. such as My name is <BDan<b and I
want to be bold but it does not work.
.



  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default html tags with a cell

You, the man!

Can I apply a format to any string or just to the
contents of a range???

Thanks


-----Original Message-----
Characters Property Example

This example formats the third character in cell A1 on

Sheet1 as bold.

With Worksheets("Sheet1").Range("A1")
.Value = "abcdefg"
.Characters(3, 1).Font.Bold = True
End With
--

John

johnf202 at hotmail dot com


wrote in message
...
I never did post a question with this statement - is
there a way to format a part of a cell?



-----Original Message-----
I thought I could use html tags within a cell to bold
cetain words etc. such as My name is <BDan<b and I
want to be bold but it does not work.
.



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default html tags with a cell

Hello dan,

Here is a test code what I wrote(for fun!). :D
Try input text in a cell with <b </b Tags.



Code:
--------------------

Option Explicit

'Written by Colo 18 Dec 2003

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
BoldWithTag Target
End Sub

Private Sub BoldWithTag(ByVal Target As Range)
Dim c As Range
Dim blnFlag As Boolean
Dim i As Long, st As Long, ed As Long
Dim Start() As Long, Length() As Long
If Target.Rows.Count = Rows.Count Then Exit Sub
If Target.Columns.Count = Columns.Count Then Exit Sub
For Each c In Target
With c
Do
st = InStr(1, .Value, "<b", 1)
If st = 0 Then Exit Do
ed = InStr(st, .Value, "</b", 1)
If ed = 0 Then Exit Do
blnFlag = True
.Value = Left(.Value, st - 1) & _
Mid(.Value, st + 3, ed - st - 3) & _
Right(.Value, Len(.Value) - ed - 3)
i = i + 1
ReDim Preserve Start(1 To i): ReDim Preserve Length(1 To i)
Start(i) = st: Length(i) = ed - st - 3
Loop
If blnFlag Then
For i = LBound(Start) To UBound(Start)
c.Characters(Start(i), Length(i)).Font.Bold = True
Next
End If
st = 0: ed = 0: i = 0: Erase Start: Erase Length: blnFlag = False
End With
Next
End Sub

--------------------



---
Message posted from http://www.ExcelForum.com/



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default html tags with a cell

Place that code in ThisWorkbook module please!


---
Message posted from http://www.ExcelForum.com/

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default html tags with a cell

Any object which has the characters property and supports Rich Text
Formatting. For example, the text of cell comments, text in the textbox
from the drawing toolbar.

--
Regards,
Tom Ogilvy

wrote in message
...
You, the man!

Can I apply a format to any string or just to the
contents of a range???

Thanks


-----Original Message-----
Characters Property Example

This example formats the third character in cell A1 on

Sheet1 as bold.

With Worksheets("Sheet1").Range("A1")
.Value = "abcdefg"
.Characters(3, 1).Font.Bold = True
End With
--

John

johnf202 at hotmail dot com


wrote in message
...
I never did post a question with this statement - is
there a way to format a part of a cell?



-----Original Message-----
I thought I could use html tags within a cell to bold
cetain words etc. such as My name is <BDan<b and I
want to be bold but it does not work.
.



.



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
Remove HTML TAGS samboy Excel Discussion (Misc queries) 0 January 12th 09 07:51 PM
Concatenate & Use HTML tags? cyndiwise notsowise Excel Discussion (Misc queries) 0 August 5th 08 06:06 AM
HTML Tags Andrew Excel Worksheet Functions 2 March 23rd 07 06:30 PM
Remove html markup tags in an EXCEL cell? glennwhite Excel Discussion (Misc queries) 3 June 5th 06 07:25 AM
Adding HTML tags to cell content cammo Excel Discussion (Misc queries) 1 December 1st 05 02:22 PM


All times are GMT +1. The time now is 05:57 PM.

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"