简体   繁体   English

通过VBA访问单元格样式的内部颜色?

[英]Access the interior color of a cell style from VBA?

My workbook has a cell style that is called "Normal Formula". 我的工作簿具有一种称为“常规公式”的单元格样式。 Is it possible to access the interior color of this cell style from VBA? 是否可以从VBA访问此单元格样式的内部颜色?

I've tried: 我试过了:

rCell.Interior.Color = ActiveDocument.Styles("Normal Formula").Interior.Color

but VBE gives me an object required error. 但是VBE给了我一个对象必需的错误。

The code I found was from msdn for word. 我发现的代码来自msdn。 When I replaced activedocument with thisworkbook, the code worked. 当我用thisworkbook替换activedocument时,代码起作用了。

rCell.Interior.Color = ThisWorkbook.Styles("Normal Formula").Interior.Color

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM