Hello,
I am ABSOLUTELY UNABLE to copy sheets in my COM Excel in Visual C++. Otherwise it works quite fine, I can open files, write to them, save, format, etc. etc. but copying sheets is beyond my abilities. It is however extremely important for me to be able to do it!!
pXL.CreateInstance(L"Excel.Application.9");
pXL->Visible = VARIANT_TRUE;

WorkbooksPtr books = pXL->Workbooks;
_WorkbookPtr pBook;
WorksheetsPtr sheets;
_WorksheetPtr pSheet;

books->Open("VZOR21.XLS"");
pBook = books->GetItem("VZOR21.XLS");
sheets = pBook->GetSheets();
//all this works but
((_WorksheetPtr)(sheets->GetItem("1")))->Copy(COleVariant("2"));
nor anything similar does not work and I do not know why!! There are sheets "1" and "2" (and many others) in the file, so WHY?? I am able to compile it but running it always ends with an exception.

If somebody were able to help me, I would be EXTREMELY GRATEFUL. THANKS A LOT!!!

regards,
Martin