Page 1 of 1

OleExcel

Posted: Fri Aug 01, 2008 3:13 pm
by Euclides
Hi to all!
I am working with Excel sheets an could not translate some VB commands.

- To change the row height
Rows("15:15").Select
Selection.RowHeight = 39

- There is a rectangle defined and I need to write on it.
ActiveSheet.Shapes("Rectangle 5").Select
Selection.Characters.Text = "X"
With Selection.Characters(Start:=1, Length:=3).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

TIA & Regards, Euclides

Posted: Fri Aug 01, 2008 5:11 pm
by gkuhnert
Euclides,

maybe you need something like this:

Code: Select all

    oSheet:Rows("15,16"):Rowheight := 35
    oSheet:Rows("11"):Rowheight := 20

    oSelect := ActiveSheet.Shapes("Rectangle 5")
    oSelect:Characters():Text = "X"
    oSelFont:=oSelect:Characters(Start:=1, Length:=3):Font()
    oSelFont:Name := "Arial"
    oSelFont:FontStyle := "Normal"

Posted: Tue Aug 05, 2008 2:02 pm
by Euclides
Hi Gilbert, thanks for the replay and sorry for the delay :-))

1 - I quit using SHAPES.

oSelect:=oSheet:Shapes("Rectangle 5")
gives error
Error 1643324/3 DISP_E_MEMBERNOTFOUND: SHAPES

I will write on the cells. is not so fancy but works.

2 - oSheet:Rows("15"):Rowheight := 35
changes the row height, but:
uVar := oSheet:Rows("15"):Rowheight
always returns "*"
there is a way to check the Height of the Row?

TIA and regards, Euclides

Posted: Tue Aug 05, 2008 3:11 pm
by Enrico Maria Giordano
I don't know if this is useful for you but here it is a working sample I found on my samples directory:

Code: Select all

FUNCTION MAIN()

    LOCAL oExcel, oSheet

    oExcel = CreateObject( "Excel.Application" )

    oExcel:WorkBooks:Add()

    oSheet = oExcel:ActiveSheet

    oSheet:Shapes:AddPicture( "E:\XHARBOUR\SFONDO.JPG", .F., .T., 0, 0, 200, 150 )

    oSheet:Shapes[ 1 ]:IncrementTop( 50 )
    oSheet:Shapes[ 1 ]:IncrementLeft( 50 )

    oSheet:Shapes[ 1 ]:Height = 50
    oSheet:Shapes[ 1 ]:Width = 50

    oExcel:Visible = .T.

    RETURN NIL
EMG

Posted: Wed Aug 06, 2008 7:18 am
by gkuhnert
Euclides,

as oSheet:Rows() can contain several rows, there isn't a defined rowheight.
but oSheet:Cells( 1, 15):rowheight seems to work fine, as it only contains this particular cell.

Posted: Wed Aug 06, 2008 12:43 pm
by Euclides
Thanks Enrico and Gilbert
The project is almost ready.
I only have to find a way to write text into the shapes.
Regards and thanks again.
Euclides