Link to home
Start Free TrialLog in
Avatar of tradinfo
tradinfo

asked on

Urgent! How to add rows or columns in Excel via OLE automation???

Hi,
I hope someone know how I could add empty rows or columns in Excel via OLE Automation (using MsVC++5) ???
Thanks in advance!
P.S: I know how OLE automation works, but i am unable to find the answer to this question...
Avatar of proskig
proskig

Check this article http://www.codeguru.com/misc/excel_automation.shtml
So if you know how to accomplish your task using VBA - the article will help. If not the easiest way can be to record macro - do what you need (e.g. to add empty cells) and then to use code for recorded macro
Avatar of tradinfo

ASKER

Sorry, but it does not solve my problem at all.
By adding rows or columns, I mean "INSERTING" rows in an existing worksheet, between 2 existing filled rows...
Do you know the way to insert rows in Excel, via automation with MsVC++ ???
Have you tryed the Insert Method for a range object...as in...

LPDISPATCH lpDisp;
Range range;  
lpDisp = sheet.GetRange(COleVariant(cell), COleVariant(cell));
ASSERT(lpDisp);
range.AttachDispatch(lpDisp);
range.Insert(xlShiftToRight);
Where could I find all the constants used in Excel, like xlVAlign, xlShiftToRight, etc...
Do you know a document which enumerates all these constants?
I have found myself the answer.
This question has a deletion request Pending
This question no longer is pending deletion
ASKER CERTIFIED SOLUTION
Avatar of MT_MU
MT_MU

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you.
You're welcome.