>Hello everybody
>
>I create an excel.sheet and put some data into the cells
>oleApp = CREATEOBJECT("Excel.Application")
>OleApp.Visible=.T.
>OleApp.Workbooks.Add
>OleApp.Cells(1,1).Value=
>OleApp.Cells(1,2).Value=
>
>..........
>Now i want to format the cells (alignment right and optimal column width)
>(i get the code from recording a macro)
>
> OleApp.Range("A:AZ").Select
> With oleapp.Selection
> .HorizontalAlignment = 'xlRight'
> .VerticalAlignment = 'xlBottom'
> .WrapText = .F.
> .Orientation = 0
> .AddIndent = .F.
> .IndentLevel = 0
> .ShrinkToFit = .F.
> .ReadingOrder = 'xlContext'
> .MergeCells = .F.
> .Columns.AutoFit
> EndWith
>OleApp.Range("A1").Select
>
>error:
>horizontal alignmennt property can't be set !!
>same to vertical alignment and readingorder
>
>What am i missing ???????
>
>Any help welcomed
>Best regards
>Albert
Albert,
You are using defined constants
#DEFINE xlLeft -4131
#DEFINE xlRight -4152
#DEFINE xlTop -4160
#DEFINE xlContext -5002
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.ReadingOrder = xlContext
Gregory