Excel 2003中的TintAndShade和PatternTintAndShade [英] TintAndShade and PatternTintAndShade in Excel 2003

查看:491
本文介绍了Excel 2003中的TintAndShade和PatternTintAndShade的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Excel 2007 vba宏中添加了TintAndShadePatternTintAndShade.一位同事在Excel 2003中对其进行了尝试,发现这些命令在那里不起作用.

I added TintAndShade and PatternTintAndShade to an Excel 2007 vba macro. A colleague tried them out in Excel 2003 and found that those commands did not work there.

然后如何将以下代码转换为可在Excel 2003中运行的代码?

How can I then convert the following code into something that will work in Excel 2003?

With Selection.Interior
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    .Color = 5296274
    .TintAndShade = 0
    .PatternTintAndShade = 0
End With

其中需要转换的行是:

    .TintAndShade = 0
    .PatternTintAndShade = 0

注意:我用它来更改单元格属性.

推荐答案

TintandShade仅适用于Excel 2003中的形状.单元格卡有标准的丑陋颜色.不过,您可以根据版本来设置代码的条件.

TintandShade only works for shapes in Excel 2003. Cells are stuck with the standard ugly colors. You can make your code conditional based on version though.

    With Selection.Interior
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    .Color = 5296274

    If Application.Version >= 12 then
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End If

    End With

这篇关于Excel 2003中的TintAndShade和PatternTintAndShade的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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