VBScript で Excel
Excel のシート名を列挙する
lesson001.vbs
実行結果
Dim objExcel
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.DisplayAlerts = False '警告メッセージをOFF'ブックを読み取り専用で開く
Dim book
Set book = objExcel.Workbooks.Open(WScript.Arguments(0))For Each sheet In book.Sheets
WScript.Echo sheet.Name
NextobjExcel.Quit
Set objExcel = Nothing
C:\>cscript c:\study\vbscript\chapter004\lesson001.vbs c:\study\Book1.xls //nolo
go
Sheet1
Sheet2
Sheet3