03-05-2012 04:12 AM
Hi
Im using CVI 2009 and trying to open a workbook using the Excel 11.0 object library.
This is what i got so far:
Excel_NewApp (NULL, 1, LOCALE_NEUTRAL, 0,&ExcelStruct.AppHandle); Excel_WorkbooksOpen (ExcelStruct.AppHandle, NULL, Mapping.ExcelFilePath, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, &ExcelStruct.WorkBookHandle); // Get First Sheet Excel_WorkbookGetWorksheets (ExcelStruct.WorkBookHandle, NULL,&ExcelSheetsHandle); Excel_SheetsGetItem (ExcelStruct.AppHandle, NULL, CA_VariantInt(1),&ExcelStruct.WorkSheetHandle);
I keep on getting an Unknown error when trying to open a workbook.
Im i doing this correct?
03-05-2012 05:18 AM - edited 03-05-2012 05:19 AM
I suggest you read this old post from Chris Matthews which explains some detail on the function.
03-05-2012 06:35 AM
Thanks that helped.
But what im really trying to do is copy a sheet from one workbook and add it to a different workbook.
Do you perhaps know how to do this or point me in the right direction?