View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Batailleye Batailleye is offline
external usenet poster
 
Posts: 3
Default characters object limit

On Jun 25, 3:32 pm, "Jim Cone" wrote:
You can replace text characters using the Mid "Statement".

Sub MoreTextStuff()
Dim strOld As String
strOld = Range("B5").Text
Mid$(strOld, 300, 5) = "stuff"
Range("B5").Value = strOld
End Sub
--
Jim Cone
San Francisco, USAhttp://www.realezsites.com/bus/primitivesoftware

"Batailleye"
wrote in message
Hello,
Is there a way to have more than 256 text characters per cell? I'm
writing a macro that uses the characters object, and that works with
strings that are shorter than 256 characters. Every time I have more
than 256 characters, I get a run-time error. It says "Runtime Error
'1004' Unable to set the text property to the characters class." I'm
using Excel 2000. My code is:

Do While i < c.Characters.Count + m
If c.Characters(i, 1).Text = Chr(34) And x Mod 2 0 Then
c.Characters(i, 1).Text = "“"
x = x + 1
i = i + 6
ElseIf c.Characters(i, 1).Text = Chr(34) And x Mod 2 = 0 Then
c.Characters(i, 1).Text = "”"
x = x + 1
i = i + 6
Else
c.Characters(i, 1).Text = c.Characters(i, 1).Text
i = i + 1
End If
Loop
Thank you


Jim,

Thanks for your reply. The problem I run into when I use a variable
to store the cell's text is that I lose the text's formatting. In
this particular case, the first character is a superscript. When I
run a macro storing the text in a variable, all the text becomes
superscript.