M
Matthias Hurrle
Hi!
I get an "Unknown error 0x800A03EC" COM-error when I try the following:
{
// Sort Columns:
CComVariant _varEmpty;
CComVariant _varItem( 1 );
CComVariant Key1( _Range ); // (CString _Range = "A2")
CComVariant OrderCustom( 1 );
CComVariant MatchCase( false );
_varEmpty.vt = VT_ERROR;
_varEmpty.scode = DISP_E_PARAMNOTFOUND;
Excel::XlYesNoGuess _xlGuess = Excel::xlGuess;
Excel::XlSortOrder _XlSortOrder = Excel::xlAscending;
Excel::XlSortMethod _XlSortMethod = Excel::xlStroke;
Excel::XlSortOrientation _xlSortColumns = Excel::xlSortColumns;
// Get Cell:
Excel::RangePtr SortRange = _WorkSheetPtr->GetRange(CComVariant(_Range), CComVariant(_Range));
// Select Cell:
SortRange->Select();
// Catch ReturnValue of Sort:
CComVariant retvalSort;
// Start Sorting Columns
retvalSort = SortRange->Sort(
Key1, // const _variant_t & Key1, "A2"
_XlSortOrder, // enum XlSortOrder Order1, xlAscending
_varEmpty, // const _variant_t & Key2, ""
_varEmpty, // const _variant_t & Type, ""
_XlSortOrder, // enum XlSortOrder Order2, xlAscending
_varEmpty, // const _variant_t & Key3, ""
_XlSortOrder, // enum XlSortOrder Order3, xlAscending
_xlGuess, // enum XlYesNoGuess Header, xlGuess
OrderCustom, // const _variant_t & OrderCustom, 1
MatchCase, // const _variant_t & MatchCase, False
_xlSortColumns, // enum XlSortOrientation Orientation, xlSortColumns
_XlSortMethod); // enum XlSortMethod SortMethod ); xlStroke
}
Has anyone a clue, what is wrong with that?
The Conditions are:
IDE: VisualC++
Excel Version: Excel9 (Office 2000)
Excel-access: via #import created excel9.tlh
TIA for help,
Matthias
I get an "Unknown error 0x800A03EC" COM-error when I try the following:
{
// Sort Columns:
CComVariant _varEmpty;
CComVariant _varItem( 1 );
CComVariant Key1( _Range ); // (CString _Range = "A2")
CComVariant OrderCustom( 1 );
CComVariant MatchCase( false );
_varEmpty.vt = VT_ERROR;
_varEmpty.scode = DISP_E_PARAMNOTFOUND;
Excel::XlYesNoGuess _xlGuess = Excel::xlGuess;
Excel::XlSortOrder _XlSortOrder = Excel::xlAscending;
Excel::XlSortMethod _XlSortMethod = Excel::xlStroke;
Excel::XlSortOrientation _xlSortColumns = Excel::xlSortColumns;
// Get Cell:
Excel::RangePtr SortRange = _WorkSheetPtr->GetRange(CComVariant(_Range), CComVariant(_Range));
// Select Cell:
SortRange->Select();
// Catch ReturnValue of Sort:
CComVariant retvalSort;
// Start Sorting Columns
retvalSort = SortRange->Sort(
Key1, // const _variant_t & Key1, "A2"
_XlSortOrder, // enum XlSortOrder Order1, xlAscending
_varEmpty, // const _variant_t & Key2, ""
_varEmpty, // const _variant_t & Type, ""
_XlSortOrder, // enum XlSortOrder Order2, xlAscending
_varEmpty, // const _variant_t & Key3, ""
_XlSortOrder, // enum XlSortOrder Order3, xlAscending
_xlGuess, // enum XlYesNoGuess Header, xlGuess
OrderCustom, // const _variant_t & OrderCustom, 1
MatchCase, // const _variant_t & MatchCase, False
_xlSortColumns, // enum XlSortOrientation Orientation, xlSortColumns
_XlSortMethod); // enum XlSortMethod SortMethod ); xlStroke
}
Has anyone a clue, what is wrong with that?
The Conditions are:
IDE: VisualC++
Excel Version: Excel9 (Office 2000)
Excel-access: via #import created excel9.tlh
TIA for help,
Matthias