CodePudding user response:
First of all need to be performed:MainFrm. ExcelApplication1. Connect;
CodePudding user response:
You must install an operating systemCodePudding user response:
Not a code problem, file open.Online is said to "set the second worksheet for activity worksheet" is using ExcelApplication1 Workbooks [2]. Activate, but I checked my deliph ExcelApplication1. Under the Workbooks [2] are not Activate this method, not whether I'm the Delphi problem,
CodePudding user response:
The second table is to join a table, to operate:MainFrm. ExcelApplication1. Workbooks. The Add (null, 0);//to join a book
MainFrm. ExcelWorkbook1. ConnectTo (MainFrm. ExcelApplication1. Workbooks [1]).//connect the Workbooks [1]
MainFrm. ExcelWorksheet1. ConnectTo (MainFrm. ExcelWorkbook1. Worksheets [1] as _Worksheet);
The above code for reference,
CodePudding user response:
The second table is to join a table, to operate:MainFrm. ExcelApplication1. Workbooks. The Add (null, 0);//to join a book
MainFrm. ExcelWorkbook1. ConnectTo (MainFrm. ExcelApplication1. Workbooks [1]).//connect the Workbooks [1]
MainFrm. ExcelWorksheet1. ConnectTo (MainFrm. ExcelWorkbook1. Worksheets [1] as _Worksheet);
The above code for reference,
CodePudding user response:
I can only write ExcelApplication1 WorkbooksWithout ExcelApplication1. Workbooks [1]
But why?