Control charts through VBA

F

Fredrik E. Nilsen

Hi,

First of all; thanks for all the help I have got from this group
already. I'm still experimenting with controlling charts through VBA.
I'm trying to controll the sizing of the chart object and elements of
the chart and to apply formatting based on user-defined charts in
xlusrgal.xls. This is what I've got so far:

Sub Diagram1()
If Not ActiveChart Is Nothing Then
ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:= _
"Linje1"
ActiveWorkbook.Colors = Workbooks("XLUSRGAL.XLS").Colors
With ActiveChart.Parent
.Height = 252.75
.Width = 342.75
End With
With ActiveChart.PlotArea
.Height = 204
.Width = 340
.Top = 20
End With
With ActiveChart.Legend
.Left = 0
.Top = 250
End With
Else
MsgBox "Du må merke et diagram før du utfører denne
handlingen.", _
vbExclamation, "Ingen diagram merket"
End If
End Sub

I must admit that I don't understand all of the syntax and I guess
that there are better ways to accomplish this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top