Sorry, but this is a VBA question, but since I using VBA via RB2k5r4 and I 
don't know any VB programmers, I'm coming here...

My environment: RB2k5, Office 2004, Mac OS 10.3.9

I'm writing a method that will go through each of the characters in an Excel 
cell and grab various bits of styling information for formatting later in 
PowerPoint. Where I'm having the problem is in getting to individual characters 
in a cell. Here's a shortened version of the code:

[code]
for i = 2 to (ImageCount + 1) //this goes down the column of captions
    theRange = "G" + str(i)
    mStyleObj = new StyleObj
        for n = 1 to len(ws.Range(theRange).Value)
                mStyleObj.Glyph.Append ws.Range(theRange).Characters(n, 1).Text 
//the problem lies here
        next
next
[/code]

Full text in the cell: "Cells of Bacillus anthracis" with "Bacillus anthracis" 
in italics

What happens is the Characters(start_param, length_param) property isn't giving 
me the expected value. When I use (n, 1) for the length_param I get the 
following:

(0)C
(1)
(2)lls of Bacillus anthracis
(3)ls of Bacillus anthracis
(4)s of Bacillus anthracis
(5) of Bacillus anthracis

So, just for kicks I tried the following...
Using (n, -1) for Param_Length gives me this:
(0) Cells of Bacillus anthracis
(1)ells of Bacillus anthracis
(2)lls of Bacillus anthracis
(3)ls of Bacillus anthracis
(4)s of Bacillus anthracis
(5) of Bacillus anthracis
 
Using (n, 0) gives me this:
(0)
(1)ells of Bacillus anthracis
(2)lls of Bacillus anthracis
(3)ls of Bacillus anthracis
(4)s of Bacillus anthracis
(5) of Bacillus anthracis

Finally, using just (n) for Param_Length gives me this:
(0)Cells of Bacillus anthracis
(1)ells of Bacillus anthracis
(2)lls of Bacillus anthracis
(3)ls of Bacillus anthracis
(4)s of Bacillus anthracis
(5) of Bacillus anthracis

Now, I can use RB's own Left command to give me just the one character I want, 
but that still doesn't give me access to the other information I'm looking for 
like the font, styling, etc. Because the entire remainder of the cell contents 
is being returned, the styling just comes up as the default font of the cell. I 
have considered making another OLEObject that would grab the character object, 
but it seems that it should be simpler than that based on my past experience 
with PowerPoint and working with text.

So, am I missing in VB/VBA or Excel, or did I find a bug of some sort?

TIA!
--
Philip Regan
[EMAIL PROTECTED]
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to