Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Copy/Paste error
I've been handed a piece of code and told to work out why it's
breaking. Basically There is a for loop that copies a range using CopyPicture, and pastes it into a chart object to finally export the chart as a JPEG. What I am getting is an error - 1004 Microsoft Excel cannot paste the data. This error will occur at random times and it seems to happen sooner with more processes running. I can get through approx x number of iterations, close the book, repoen and start again from x getting approx the same number of iterations. Any Ideas? Thanks in advance... rngSelection.CopyPicture Appearance:=xlScreen, Format:=xlPicture ' Add a chart object to the activesheet Set cto = ActiveSheet.ChartObjects.Add(0, 0, 800, 600) Set cht = cto.Chart ' Paste the picture onto the chart and set an object variable for it cto.Activate With cht ChartArea.Select .Paste End With |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Copy/Paste error
Try adding a dot in front of Chart.Area.Select...
With cht .ChartArea.Select .Paste End With -- Jim Cone Portland, Oregon USA "Deorum" wrote in message I've been handed a piece of code and told to work out why it's breaking. Basically There is a for loop that copies a range using CopyPicture, and pastes it into a chart object to finally export the chart as a JPEG. What I am getting is an error - 1004 Microsoft Excel cannot paste the data. This error will occur at random times and it seems to happen sooner with more processes running. I can get through approx x number of iterations, close the book, repoen and start again from x getting approx the same number of iterations. Any Ideas? Thanks in advance... rngSelection.CopyPicture Appearance:=xlScreen, Format:=xlPicture ' Add a chart object to the activesheet Set cto = ActiveSheet.ChartObjects.Add(0, 0, 800, 600) Set cht = cto.Chart ' Paste the picture onto the chart and set an object variable for it cto.Activate With cht ChartArea.Select .Paste End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
simple copy paste multiple range macro ARGUMENT ERROR | Excel Programming | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming | |||
Cut and Paste using Macro gives paste special method error | Excel Programming | |||
Macro to Copy/Paste then Paste to Next Line | Excel Programming | |||
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) | Excel Programming |