"mStyleObj.Glyph" is an array in a custom object ("StyleObj") I created
to hold formatting issues, with Glyph specifically the text of the
character being referenced. Are you on a PC? Because on the outset my
"ws.Range(theRange).Characters(n, 1).Text" is pretty much the same thing
as your "objSel.Characters(n, 1).Text". When I get a chance later today
I'll try your code.

Thanks


[EMAIL PROTECTED] wrote:

The following code in Excel VBA returns the characters as expected:

Sub Test_Code()
    Dim objSel As Object
    Dim TestString As String
    
    Set objSel = Selection
    
    For n = 1 To Len(objSel.Value)
        TestSting = objSel.Characters(n, 1).Text
    Next

End Sub

I am not familiar with the Style Object, but I note that I do not find
"Glyph" referenced as a Style Object parameter in the VBA help.  It may
be that this construction (mStyleObj.Glyph.Append) is not acceptable
width='100%' in VBA, which could be causing the strange results, or your
programming knowledge exceeds mine.  I am not sure which.

Kurt Garnjost

  

==================================================

Message: 10
Subject: [OFF] Excel VBA via RB problem, possibly a bug?
From: [EMAIL PROTECTED]
Date: Thu, 18 Jan 2007 17:21:06 -0500

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>
_______________________________________________
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