Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have some VB code that places formatted text strings in cells. The formats
consist of color as well as italics and underlining. I apply the formatting using an "objcell.characters(intStart, intLength).Font.Italic" type of approach. Where I am having trouble is when I want to add more text to the cell later. The formats seem to shift or change. What might have been previously not underlined is now underlined for example. The colors tend to work properly but the italic, bold, or underline settings have been unstable. For example, the existing string might have been italic and I try to add plain text to it without affecting the italic stuff. The result might be either all italic or all plain. I modify the strings using the formula property and perhaps that is the problem but I can't seem to think of another way to add text. Should I be using a different method to build the strings? It really is frustrating because this should have been the easy part of the code I wrote and it is killing me. Has anyone else written code that does something similar? I am sure feeling like an idiot banging my head up against this issue. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi ScabHead
Have you tried following approach to insert data Range("A1").Characters(Start:=8,Length:=1).Insert "Y" This replaces the 8th character Range("A1").Characters(Start:=8,Length:=0).Insert "Y" This does not replace any character and adds Y in the 8th position etc "scabHead" wrote: I have some VB code that places formatted text strings in cells. The formats consist of color as well as italics and underlining. I apply the formatting using an "objcell.characters(intStart, intLength).Font.Italic" type of approach. Where I am having trouble is when I want to add more text to the cell later. The formats seem to shift or change. What might have been previously not underlined is now underlined for example. The colors tend to work properly but the italic, bold, or underline settings have been unstable. For example, the existing string might have been italic and I try to add plain text to it without affecting the italic stuff. The result might be either all italic or all plain. I modify the strings using the formula property and perhaps that is the problem but I can't seem to think of another way to add text. Should I be using a different method to build the strings? It really is frustrating because this should have been the easy part of the code I wrote and it is killing me. Has anyone else written code that does something similar? I am sure feeling like an idiot banging my head up against this issue. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
tabsheet-function to get the formatted text of a cell | Excel Discussion (Misc queries) | |||
A lot of #'s in my text-formatted cell... | Excel Discussion (Misc queries) | |||
Formula fails in text formatted cell | Excel Worksheet Functions | |||
Formatted Cell Changes Format When Text Is Entered | Setting up and Configuration of Excel | |||
Converting 'General' formatted cells to Text formatted cell using. | Excel Worksheet Functions |