Hi Chris,

can you give an example. I've also wrote to excel with less problems, if you consider some systax limitations. Cells(1,1) for Example cannot be used. You have to do something like: Cells().Item(1, 1)

Here is a very simple example to write in row 2, column 2 of a newly created worksheet. The problem is that the "Item" method on class "range" doesn't return a range object. It sadly returns it packed into a variant.

static void TestExcel(Args _args)
    COM app, Workbooks, Workbook, Worksheets, Worksheet;
    COM Cells; // All cells in the worksheet
    COM RCell; // ... will be a single cell

    app = new COM("Excel.Application");
    Workbooks = app.Workbooks();
    Workbook = Workbooks.Add();
    Worksheets = Workbook.Sheets();
    Worksheet = Worksheets.Item(1);
    Cells = Worksheet.Cells();

    // cast COMVariant returned by Cells.Item to COM
    RCell = COM::createFromVariant(Cells.Item(2, 2));


Andreas Gahr

-----Ursprüngliche Nachricht-----
Von: Chris Trybus [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 10. Mai 2004 09:41
Betreff: [development-axapta] getting text out of a cell in Excel

Hi all

In my project I'm writing data into an excel spreadsheet. The problem is I
want to be able to check what text is in a certain cell before I right to a

The only method/property that I could find is the .value method but when I
try compile using this method Axapta gives the error "The table is out of
range or does not exist." I have also tried using the formula() but this
also gives an error. I am also using the range method to get the cell
because when I used the cells(1,1) method this gave an error method called
with invalid number of parameters.



[Non-text portions of this message have been removed]

Yahoo! Groups Links

Yahoo! Groups Sponsor
click here

Yahoo! Groups Links

Reply via email to