View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Paul M.[_2_] Paul M.[_2_] is offline
external usenet poster
 
Posts: 4
Default Character.Font Properties.

Hello peoples,

I have a quick question regarding the cells character
property in particular when you use the .font.fontstyle
property to change the bold properties of in-string text.

I have a cell that has a concatenating value, where the
cell's value is constantly added to when the criteria
matches within a for i loop.

I have some code which locates certain characters within
the newly added content to bold using the Characters
(Start, Length).Font.Fontstyle = "Bold" property.

The only problem is that when the property is set, it
resets the previous bold property to normal. so in effect
only the last value is properly bolded.

When you run the marco recorder, it sets the entire
string length's property toggling where appropriate.

My Question is:

Can I store the cell's formatting properties?
If so how can I access them?

The Output string looks like this (Cell Value):

[SE]-TA <Random Info Atts: 0
[TR]-NS <Random Info Atts: 120
[CP]-QL <Random Info Atts: 0

Where text within the "<" & "" is to be bolded.

Following is the code use to format the portion of the
text to be added.
----------------------------------------------------------
event_conc = "[" & iGroup & "] - " & istate
& " <" & iProg & " " & "Atts: " & iAtt & Chr(10)
iPosStart = InStr(1, event_conc, "<") + 1
iPosEnd = InStr(1, event_conc, "") - 1
rep_out_count_value = ("rep_out_" &
rep_out_count)
rep_out_cur_value = Worksheets("Event
Calendar").Range(rep_out_count_value).Value
strCurrLen = Len(rep_out_cur_value)
With Worksheets("Event Calendar").Range
("rep_out_" & rep_out_count)
.FormulaR1C1 = rep_out_cur_value &
event_conc
.Characters(Start:=strCurrLen +
iPosStart, Length:=strCurrLen + iPosEnd).Font.FontStyle
= "Bold"
End With
----------------------------------------------------------
Is there a way I can store the previos property, if not,
how would one go about re-formatting the text with
multiple inStr("<")'s

Your help is greatly appreciated.


Paul M.