Macro Compatibility

A

ARCUser

Hello Everyone,
I have upgraded to Office 2007 from 2003 and now my users are complaining
about a macro that they use is not running. The code error's out on the
following line "ActiveSheet.ChartObjects(Varname).Activate"
This macro and many like it worked perfectly for 2003, is there something
That I need to load or is there new terms for 2007? I have paisted the rest
of the code below. Please advise.
-Dave

Sub HbarMacro()
'
' HbarMacro Macro
' Macro recorded 1/31/97 by ARC
' Color bars added 4/28/04 by DHill
'
' ActiveSheet.ChartObjects("Chart 1").Activate
' ActiveChart.ChartType = xl3DBarClustered
'
' Chart Macro
'
Varname1 = Selection.Address
Var = ActiveWorkbook.Name
Vars = ActiveSheet.Name
Charts.Add
ActiveChart.ChartType = xlBarClustered
'
' ActiveChart.ChartType = xl3DBarClustered
'
ActiveChart.SetSourceData Source:=Sheets(Vars).Range(Varname1), PlotBy _
:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:=Vars
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
ActiveChart.HasLegend = False
ActiveChart.ApplyDataLabels Type:=xlDataLabelsShowValue, LegendKey:=False
Windows(Var).Activate
ActiveSheet.ChartObjects.Select
Varname = Selection.Name
ActiveSheet.ChartObjects(Varname).Activate
ActiveChart.ChartArea.Select
ActiveSheet.Shapes(Varname).Width = 444
ActiveSheet.Shapes(Varname).Height = 336
With Selection.Border
.Weight = 2
.LineStyle = 0
End With
'
' Change color of interior
'
' Selection.Interior.ColorIndex = 16
Sheets(Vars).DrawingObjects(Varname).RoundedCorners = False
Sheets(Vars).DrawingObjects(Varname).Shadow = False
ActiveChart.Axes(xlCategory).Select
With Selection.Border
.ColorIndex = 57
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection
.MajorTickMark = xlCross
.MinorTickMark = xlNone
.TickLabelPosition = xlNextToAxis
End With
Selection.TickLabels.AutoScaleFont = True
'
' Font selection
'
With Selection.TickLabels.Font
.Name = "Verdana"
.FontStyle = "Book"
.Size = 10.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue).Select
With Selection.Border
.ColorIndex = 57
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection
.MajorTickMark = xlCross
.MinorTickMark = xlNone
.TickLabelPosition = xlNextToAxis
End With
Selection.TickLabels.AutoScaleFont = True
'
' Font selection
'
With Selection.TickLabels.Font
.Name = "Verdana"
.FontStyle = "Book"
.Size = 10.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.AutoScaleFont = True
'
' Font selection
'
With Selection.Font
.Name = "Verdana"
.FontStyle = "Book"
.Size = 10.5
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(1).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
'
' Bar color selection
'
With Selection.Interior
.ColorIndex = 5
.Pattern = xlSolid
End With
With ActiveChart.ChartGroups(1)
.Overlap = 0
.GapWidth = 50
.HasSeriesLines = False
.VaryByCategories = False
End With
ActiveChart.PlotArea.Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
Selection.Interior.ColorIndex = xlNone
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
'
' Change Bar Color 4/28/2004 by dhill
'

'
' ActiveChart.SeriesCollection(1).Select
' With Selection.Border
' .Weight = xlThin
' .LineStyle = xlAutomatic
' End With
' Selection.Shadow = False
' Selection.InvertIfNegative = False
' With Selection.Interior
' .ColorIndex = 5
' .Pattern = xlSolid
' End With
End Sub
 

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

Similar Threads


Top