Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I need some help in working with the EXCEL object. Urgen
Message
De
24/10/2001 06:37:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
24/10/2001 04:35:35
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00572471
Message ID:
00572489
Vues:
79
>This is my first time I'm trying to work with the EXCEL object. I would, PLEEEASEEE, need some hints like how to add a value in a certain cell, to format a cell (font, font type, borders) and other stuff that you woul consider important or interesting.
>Please help me as soon as possible,
>Thanks,
>NUTA DRAGOS

Dragos,
There are too many interesting stuff in Excel that wouldn't fit here.

For your question a simple sample :
*#include "xlconstants.h"
#Define xlFillMonths  7
#Define xlFillSeries  2
#Define xlFillValues  4
#Define xlFillWeekdays  6

ox = createobject("Excel.Application")
With ox
  .Workbooks.Add
  With .ActiveWorkbook.ActiveSheet
    .Range(.Cells(3,4), .Cells(3,52)).Value = 0
    .Range("C3").Value = 12
    .Range("C3").AutoFill(.Range(.Cells(3,3), .Cells(3,103)),xlFillSeries)
    .Range("B6").Value = "March"
    .Range("B6").AutoFill(.Range(.Cells(6,2), .Cells(6,52)),xlFillMonths)
    .Range("A1").Formula = "=sum(C3:Z3)"
    With .Range(.Cells(6,2), .Cells(6,52))
      With .Font
        .Bold=.T.
        .Italic = .t.
        .color= rgb(0,0,255)
      Endwith
      .Interior.Color = rgb(255,255,0)
    Endwith
    .Columns("B:M").EntireColumn.Autofit
  Endwith
  .visible = .t.
Endwith
You can get the syntax in most cases from Excel by recording a macro. Excel macro might not be the one you should apply for performance reasons but that comes very later.
For the above effect make the same in Excel recording a macro then compare to this code. You can see the main differences (like Name parameters vs positional). Actually I think Excel macro recorded version will be quite different from this one. Doesn't matter try to VFPize that one for testing.

You'll need xlconstants.h file. It should be somewhere here in downloads area. Next your helper is vbaxl9.chm or vba_xl8.hlp file.

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform