Resizing an Excel Chart from VB

I have found out how to add a chart to an excel file but what I want to do is move the chart  and resize it, can anybody point me in the right direction?

Here is how I am adding the chart

    Dim xlApp As Excel.Application
    Dim xlBook As Excel.Workbook
    Dim xlSheet As Excel.Worksheet
    Dim xlSheet2 As Excel.Worksheet
    Dim xlChart As Excel.Chart
    Dim i As Integer
    Dim NextVal As Integer
    ' Create Excel Application object
    Set xlApp = New Excel.Application
    ' Create a new workbook
    Set xlBook = xlApp.Workbooks.Add
    ' Get rid of all but one worksheet
    xlApp.DisplayAlerts = False
    For i = xlBook.Worksheets.Count To 2 Step -1
    Next i
    xlApp.DisplayAlerts = True
    Set xlSheet2 = xlBook.ActiveSheet
    xlSheet2.Name = "mysheet"
    Set xlChart = xlApp.Charts.Add
    With xlChart
        Dim xlsSerie As Excel.SeriesCollection
        Set xlsSerie = .SeriesCollection
        Dim xlsAxisCategory As Excel.Axes
        .ChartType = xlColumnStacked
        .SetSourceData xlSheet2.Range("B1:B" & j)
        xlsSerie.Item(1).HasDataLabels = True
        Set xlsAxisCategory = .Axes(, xlPrimary)
        xlsAxisCategory.Item(xlCategory).HasTitle = True
        xlsAxisCategory.Item(xlCategory).AxisTitle.Characters.Text = "Hours"
        .PlotBy = xlColumns
        .Location xlLocationAsObject, conSheetName2
    End With
    With xlBook.ActiveChart
        .HasTitle = True
        .HasLegend = True
        .SeriesCollection(1).XValues = xlSheet2.Range("A1:A" & j)
        With .ChartTitle
            .Characters.Text = conSheetName2 & " Chart"
            .Font.Size = 12
            .Shadow = True
            .Border.LineStyle = xlSolid
        End With
        With .ChartGroups(1)
            .GapWidth = 14
            .VaryByCategories = True
        End With
    End With

Thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

From record the macro

' move
ActiveSheet.Shapes("Chart 1").IncrementLeft -95.4
ActiveSheet.Shapes("Chart 1").IncrementTop -94.2
ActiveSheet.Shapes("Chart 1").ScaleWidth 1.51, msoFalse, msoScaleFromTopLeft
ActiveSheet.Shapes("Chart 1").ScaleHeight 1.39, msoFalse, msoScaleFromTopLeft
I'm getting errors from your code - j is not set and neither is conSheetName2

Assuming you want the chart loose on mysheet then change your location line a little

        .Location Where:=xlLocationAsObject, Name:=xlSheet2.Name

The position of the chart is handled by the ChartObject (the container for the chart itself)

    With xlSheet2.ChartObjects(1)
        .Left = 40
        .Top = 40
    End With


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.