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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA chart Please can someone look at my code

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
Hi,
im running this code from powerpoint and cant see where it is going wrong, please can someone have alook for us


Dim ChtNew
WrkShtNew.Name = chkd(Y)

Set ChtNew = Wrkbknew.Charts.Add


With ChtNew
.ChartType = xlColumnClustered
.SetSourceData Source:=Sheets(chkd(Y)).Range("A1:AW2"), PlotBy:=xlRows
.Location Where:=xlLocationAsObject, Name:=chkd(Y)
With ChtNew.Axes(xlcatergory).TickLabels

With .Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With

End With
.Alignment = xlCenter
.Offset = 100
.Orientation = xlUpward




With .PlotArea.Border
.Weight = xlThin
.LineStyle = xlNone
End With

With .PlotArea.Interior
.Interior.ColorIndex = xlNone
End With
.HasAxis(xlCategory, xlPrimary) = True
.HasAxis(xlValue, xlPrimary) = True
.HasLegend = False

End With



Y = Y + 1


thanks


Chance

 
Chance1234

I'm not a cross application VBA genius but I'm sure you need to reference xl from powerpoint.
But without going into it completely you will need to create an object for the xl app in powerpoint so I've 'borrowed' an extract from the excel help files....

"To create an new object or get an existing object from another application, use the CreateObject function or GetObject function:

' Start Microsoft Excel and create a new Worksheet object.
Set ExcelWorksheet = CreateObject("Excel.Sheet")

' Start Microsoft Excel and open an existing Worksheet object.
Set ExcelWorksheet = GetObject("SHEET1.XLS")"

You'll find help by searching for working accross applications in the vba help

 
missed out a chunk of code at the top which has all that in ;-) basicly the formating of the chart is the bit im having problems with

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top