1

I'm working on building a couple of report files for Excel, it basically copies information over to another Workbook and saves it.

I've managed to copy my textual content just fine, but now I need to be able to copy charts over, and this is when the errors start popping...

This is what I tried:

ActiveSheet.Shapes(1).CopyPicture Appearance:=xlScreen, Format:=xlPicture
Workbooks("Relatorios.xlsm").Sheets("" & tb_nome.Text & "").Paste

This seems to work fine, the only issue is that I want the chart placed on the cell E20, I tried selecting this cell but I get an error, this is what I tried:

Workbooks("Relatorios.xlsm").Sheets("" & tb_nome.Text & "").Range("E20").Select

Without that line the chart is pasted just fine, just not where I want it.

So the final code looked like:

ActiveSheet.Shapes(1).CopyPicture Appearance:=xlScreen, Format:=xlPicture
Workbooks("Relatorios.xlsm").Sheets("" & tb_nome.Text & "").Range("E20").Select
Workbooks("Relatorios.xlsm").Sheets("" & tb_nome.Text & "").Paste

1 Answer 1

5
    ActiveSheet.Shapes(1).CopyPicture Appearance:=xlScreen, Format:=xlPicture
    With Workbooks("Relatorios.xlsm").Sheets(tb_nome.Text)
        .Paste
        .Shapes(.Shapes.Count).Top = .Range("E20").Top
        .Shapes(.Shapes.Count).Left = .Range("E20").Left
    End With
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.