Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy worksheets in excel automation app using VC7
Hello,
I'm doing this automation application that involves copying a sheet from a specific workbook to another workbook. I have this code: CWorkbook WinBook = books.Open(szWorkbook,covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional ); CWorkbook BRBook = books.Open(szWorkbook2,covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional ); WBSheets = WinBook.get_Sheets(); BRSheets = BRBook.get_Sheets(); WBsheet = WBSheets.get_Item(COleVariant((short)3)); BRSheet = BRSheets.get_Item(COleVariant((short)1)); CString s1 = CString("["); s1+= CString(WinBook.get_Name()); s1+= CString("]"); s1+= CString(WBsheet.get_Name()); BRSheet.Copy(covOptional,COleVariant(s1)); ... So this piece of code opens two workbooks: one source (BRBook) and one destination(WinBook). Takes the sheet to be copied: BRSheet and builds a string that descibes the sheet after wicht the sourche sheet should be put. But this code gives me a runtime error message saying the copy method of the sheets object failed. What am i doing wrong? Thank you very mucht, Yannick from belgium |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Automation : numbers Copy/Paste issue from VB6 | Excel Programming | |||
Copy Excel worksheets | Excel Discussion (Misc queries) | |||
Copy generates an automation error. | Excel Programming | |||
Compiling different worksheets, via automation. | Excel Programming | |||
Excel Worksheets.Copy in VBS??? | Excel Programming |