Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3029

How to Add new sheet to the end?

$
0
0
Hi,
I have searched a lot of post but still haven't found an answer, the code I use is as follows:

HTML Code:

Excel::WorksheetsPtr ws = Worksheets->GetItem(Worksheets->Count); <<-- last worksheet

//Syntax:  IDispatchPtr Sheets::Add ( const _variant_t & Before, const _variant_t & After,
//                                    const _variant_t & Count, const _variant_t & Type, long lcid );
Worksheets->
Add(vtMissing, ws,  <<-- add to last
                            1, vtMissing, (long)Excel::xlWorksheet));

This doc say:

HTML Code:

After        Optional        Variant        An object that specifies the sheet after which the new sheet is added.
but how to convert IDispatchPtr to _variant_t ?

Thanks you!

Viewing all articles
Browse latest Browse all 3029

Latest Images

Trending Articles



Latest Images