Home > Back-end >  Delphi7 no ExcelApplication1. Workbooks [1]. The Activate method
Delphi7 no ExcelApplication1. Workbooks [1]. The Activate method

Time:09-26

My environment is an Delphi7 + + win2003, when using excel, whether using Delphi7 own controls, or use Comobj way, want to change to sheet2 to the current active page found no ExcelApplication1. Workbooks [2]. The Activate method, is Delphi7 version of my questions? Or other reasons!

CodePudding user response:

First of all need to be performed:
MainFrm. ExcelApplication1. Connect;

CodePudding user response:

You must install an operating system

CodePudding 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 Workbooks
Without ExcelApplication1. Workbooks [1]
But why?
  • Related