Excel help

R

Ritu Khattar

Hello,

I have a problem. I am using VC++ to create an Application
object of Excel to do some things in the excel sheet
dynamically.

I want to move a sheet in Excel workbook to the end of all
sheets using the code shown below.
COleVariant
covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);

sheet = sheets.GetItem(COleVariant((short)1));
sheet.Move(covOptional,COleVariant((short)4));

But i get and exception from excel.

When i try to use

sheet = sheets.GetItem(COleVariant((short)1));
sheet.Move(covOptional,covOptional);

Than it does not give any error but it does nothing that i
want.

Can any one tell me what am i dng wrong and how to do this
rightly...

Also i can add a new sheet but when i try to do it at the
end it gives error.For example when i do this

sheets.Add(covOptional,covOptional,COleVariant((short)
1),covOptional);

It adds a new sheet in the beginning but

when i try to do this

sheets.Add(covOptional,COleVariant((short)3),COleVariant
((short)1),covOptional);

It gives error!! I need some help on this

Anyone!!

Regards
Ritu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top