如何获取Excel工作簿选项卡颜色名称? [英] How to get Excel Workbook Tab Color Name?

查看:138
本文介绍了如何获取Excel工作簿选项卡颜色名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用下面的代码获取工作簿excel的tabcolor:



I tried this code below to get the tabcolor of a workbook excel:

dim xcolor as string = worksheet.tabcolor.tostring





但它不起作用。



我只想要这样的东西:





but it doesnt work.

I just want semething that will show like this:

xcolor = RED (if the tabcolor is red)

推荐答案

您需要名为ColorIndex的属性: [ ^ ]



You need the property called "ColorIndex":[^]

Dim xcolor as Integer = Sheets("Sheet1").Tab.ColorIndex
 '3=Red , 4=green,5=blue,6=yellow,etc...

If xcolor = 3 Then
'do something
End If


这篇关于如何获取Excel工作簿选项卡颜色名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆