HotXLS 文件

Add 方法

Defines new 名稱. 傳回 IXLSName 介面

語法

函式 新增(名稱: Widestring; RefersTo: Widestring): IXLSName;
函式 新增(名稱: Widestring; RefersTo: Widestring; Visible: 布林值): IXLSName;
函式 新增(名稱: Widestring; SheetName: Widestring; 列: 整數; Col: 整數): IXLSName;
函式 新增(名稱: Widestring; SheetName: Widestring; Row1: 整數; Col1: 整數; Row2: 整數; Col2: 整數): IXLSName;
Name Required Widestring. 文字 到 use as 名稱. Names cannot include spaces 和 cannot look like 儲存格 references
RefersTo Required Widestring. Describes what 名稱 refers 到 (使用 A1-樣式 表示法)
Visible Optional 布林值. True 到 define 名稱 normally. False 到 define 名稱 as hidden 名稱 (是, it doesn't appear 在 either Define 名稱, Paste 名稱, 或 Goto dialog box). 預設值 是 True
SheetName Required Widestring. 工作表 owns target 儲存格 或 範圍
Row Required 整數. 一個-基於 列 用於 single-儲存格 target
Col Required 整數. 一個-基於 欄 用於 single-儲存格 target
Row1, Col1, Row2, Col2 Required Integers. 一個-基於 列 和 欄 coordinates 用於 rectangular target 範圍

範例

此範例 新增 new defined 名稱 用於 活頁簿 和 use 此 名稱 中的 儲存格 公式

Workbook.Names.Add('MyName','=Sheet1!$F$10:$H$20');
Workbook.Sheets[1].Cells[3,4].Formula := '=SUM(MyName)';
此範例 creates single-儲存格 和 範圍 names 從 工作表 coordinates

Workbook.Names.Add('InputCell','Sheet1',2,3);
Workbook.Names.Add('InputBlock','Sheet1',4,2,6,5);
此範例 新增 new defined 名稱 用於 工作表 一個 和 use 此 名稱 中的 儲存格 公式

Workbook.Sheets[1].Names.Add('MyName','=Sheet1!$F$10:$H$20');
Workbook.Sheets[2].Cells[3,4].Formula := '=SUM(Sheet1!MyName)';

另請參閱