PDA

View Full Version : VBA Open a Excel file and then copy charts to other excel file which is already open



Mind
08-31-2016, 01:56 AM
Hello fellows,
i need help with a VBA which i just created. I want to open a existing excel file and copy charts within this excel sheet to another one which i already opened. Somehow this doesnt work...

Dim shtOrigin1 As Worksheet
Dim shtDestin As Worksheet
Dim strFile As String


Application.ScreenUpdating = False


Set shtDestin = ActiveWorkbook.ActiveSheet


strFile = Application.GetOpenFilename


If CStr(strFile) <> "False" Then


Set shtOrigin1 = Workbooks.Open(strFile).Sheets(2)



shtOrigin1.Range("A6:L21").Select
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
shtDestin.Paste Destination:=shtDestin.Range("A1")
Application.CutCopyMode = False


End Sub

any Clues or solutions?

Thank you.

snb
08-31-2016, 02:11 AM
Use the macrorecorder.