Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program Gradient fills in Excel chart from Access 1

Status
Not open for further replies.

kndavies

Technical User
Jan 23, 2003
30
GB
I am generating a chart in Excel from Access, all of which is working fine. My client has requested that the bar charts be two colour fill and this is causing me problems, debugging the code gives "variable not defined" for 'msogradienthorizontal'. Any guidance gratefully received :)

relevent bits of code are:

With xlsApp.Application

Set objSheet = .Activeworkbook.Sheets(strSheet1)
set objChart = objSheet.ChartObjects.Add(480,400,455,429)
With objChart.Chart
With .seriescollection(1)
.Shadow = True
.Fill.TwoColorGradient Style:= msoGradientHorizontal, Variant:=1
.Fill.Visible = True
.Fill.Forecolor.Schemecolor = 1
.Fill.Backcolor.Schemecolor = 15
End With
End With
End With

Thanks,
Ken
 
kndavies,
Unless you have a reference to the Excel object library you can't use enumerated values.

Try changing [tt]msoGradientHorizontal[/tt] to 1.

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Hi CautionMP,

I guessed it would be simple, I had referenced the Excel object library but your solution works perfectly. Many thanks,

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top