主题
Type (属性)
返回一个代表工作表类型的 XlSheetType值。
示例
python
#本示例显示活动工作表类型的 XlSheetType 值
def test():
print(f"活动工作表的类型值为 {Application.ActiveSheet.Type}")
python
#本示例判断活动工作簿中每一张工作表类型,如果是工作表或图表工作表则通知用户
def test():
for i in range(1, Sheets.Count):
sheet = Application.Worksheets.Item(i)
if sheet.Type == xlWorksheet:
print(f"工作表 {sheet.Name} 类型为工作表")
elif sheet.Type == xlChart:
print(f"工作表 {sheet.Name} 类型为图表工作表")