我在MS 2007数据库中有以下代码,该数据库是以编程方式创建Excel工作表和相关图表的。当试图使用.tintandshade属性修改图表系列的内部颜色时,我会得到一个错误1004。
变量'wksIn‘是传递给Access子的excel工作表对象。变量'sRange‘是在子例程前面定义的字符串。
...
Dim shChart as Excel.Shape
Set shChart = wksIn.Shapes.AddChart(xlColumnStacked100)
Dim chChart As Excel.Chart
Set chChart = shChart.Chart
with chChart
.SetSourceData Range(sRange)
.Axes(xlValue).MajorUnit = 0.2
.SetElement (msoElementLegendBottom)
Dim srSeries As Excel.Series
srSeries = chChart.SeriesCollection(1)
with srSeries
.Interior.Color = RGB(27, 88, 124)
.Interior.TintAndShade = 0.6 ' results in error 1004
.SetElement (msoElementDataLabelCenter)
End With
End With我一直在努力避免基于本文的所有Selects和Active______引用。有人能看到一个明显的原因,为什么1004错误可能发生,以及如何纠正问题?
有趣的是,.Interior.ThemeColor属性也会导致1004错误。也许他们有血缘关系?
发布于 2015-05-07 16:39:11
正如评论中所述,室内不是正确的财产。
替换以下行(从代码中):
.Interior.Color = RGB(27, 88, 124)
.Interior.TintAndShade = 0.6 ' results in error 1004有以下几点:
.Format.Fill.ForeColor.Color = RGB(27, 88, 124)
.Format.Fill.ForeColor.TintAndShade = 0.6 https://stackoverflow.com/questions/30106231
复制相似问题