MFC, Excel and sorting

J

Jimmy

I'm writing an MFC application to populate an excel
spreadsheet, the data comes to me in no particular order.

Once I've finished, I would like Excel to sort my rows
based on a single column of data which is Text.

I'm having difficulty using the sort function, I would
appreciate help in using this function or if I even have
the correct function.

The sort function appears in the C++ class wrapper as:

VARIANT Sort(const VARIANT& Key1, long Order1, const
VARIANT& Key2, const VARIANT& Type, long Order2, const
VARIANT& Key3, long Order3, long Header, const VARIANT&
OrderCustom, const VARIANT& MatchCase, long Orientation,
long SortMethod, long DataOption1, long DataOption2, long
DataOption3);

I've tried a variety of approaches, but here's where I'm
stuck
//---------------------------------------------------------
---------------------
// Sort on column A
//---------------------------------------------------------
---------------------
range = sheet.GetRange( COleVariant(_T("A1")),
COleVariant(_T("A1")));

Range col = range.GetEntireColumn();

col.Sort(????);

// should I be using range or col, and how do I use this
sort fuction.

Many thanks,
Jim
 
Top