Guest_imported
New member
- Jan 1, 1970
- 0
I'm trying to open an excel spreadsheet using my application. I have a form with ExcelApplication, ExcelWorkbook, and ExcelWorksheet objects placed on it.
I can launch the excel application from my application but I'm having trouble connecting to a particular spreadsheet. How do I connect to a particular spreadsheet????
My code is shown below (the code is incomplete), can anyone give me an example of connecting to a file (excel NOT WORD!!) ???? :
I can launch the excel application from my application but I'm having trouble connecting to a particular spreadsheet. How do I connect to a particular spreadsheet????
My code is shown below (the code is incomplete), can anyone give me an example of connecting to a file (excel NOT WORD!!) ???? :
Code:
void __fastcall TCleaningToolForm::Button_OpenExcelFileClick(TObject *Sender)
{
PrepareExcel(); // launch excel
// get file name from user
if(OpenExcelFileDialog->Execute())
{
OleVariant FileName = OpenExcelFileDialog->FileName;
// open excel file
ExcelWorkbook1->ConnectTo(ExcelApplication1->Workbooks->Open(
}
}