OleExcel

Post Reply
User avatar
Euclides
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm

OleExcel

Post 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
User avatar
gkuhnert
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands
Contact:

Post by gkuhnert »

Euclides,

maybe you need something like this:

Code: Select all | Expand

    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"
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
Euclides
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm

Post 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
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Post 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 | Expand

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
User avatar
gkuhnert
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands
Contact:

Post 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.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
User avatar
Euclides
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm

Post 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
Post Reply