アクティブなシートの名前を設定します。
#Include <Excel.au3>
_ExcelSheetNameSet($oExcel, $sSheetName)
パラメータ
| $oExcel | _ExcelBookOpen()か_ExcelBookNew()の呼び出しで開かれているExcelオブジェクト |
| $sSheetName | シートにつける新しい名前 |
返し値
| 成功: | 1 |
| 失敗: | 0を返し@errorに値を設定します |
| @error: | 0 - 正常終了 |
| 1 - 指定されたオブジェクトが存在しません |
注意
なし。
関連
例
; ***************************************************************
; 例 1 - ワークブックを開きオブジェクト識別子取得後、アクティブなシートに設定
; *****************************************************************
#include <Excel.au3>
Local $oExcel = _ExcelBookNew() ;新しいブックを作成して表示
_ExcelSheetNameSet($oExcel, "Example") ;アクティブなシートをリネーム
MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; 上書き設定でtempディレクトリに保存
_ExcelBookClose($oExcel) ; 閉じて終わり
; ***************************************************************
; 例 2 - ワークブックを開きオブジェクト識別子取得後、アクティブなシートの名前を表示。その後、名前を変更し新しい名前を表示
; *****************************************************************
#include <Excel.au3>
Local $oExcel = _ExcelBookNew() ;新しいブックを作成して表示
MsgBox(0, "Sheet Name", "The Current Active Sheet Name Is:" & @CRLF & _ExcelSheetNameGet($oExcel))
_ExcelSheetNameSet($oExcel, "Example") ;アクティブなシートをリネーム
MsgBox(0, "Sheet Name", "Now The Current Active Sheet Name Is:" & @CRLF & _ExcelSheetNameGet($oExcel))
MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; 上書き設定でtempディレクトリに保存
_ExcelBookClose($oExcel) ; 閉じて終わり