
As you copy back and forth the destination and source workbooks' It turns out pasting from one to the other copied all the Normal cell stylesįrom one workbook to the other (I am assuming if the "Normal" cell style from the source workbook doesn't match the destination workbook's Excel creates a copy on the destination one).
#Microsoft excel cannot paste the data code
Here is the example.īesides, I also suggest you copy the range as a picture and paste to the chart directly, so we don’t need run the code to paste picture to the Cell(“BZ2“).I had a similar "Excel cannot paste the data" issue, but mine was with copying cells from one workbook to another on the same machine. As a workaround, I re-paste the picture when the error happens. There is very few chance this error happens.Īs you said, it could works when we continue to run the code in debugger. I fill out some simple date in A1 to J15 and merged some cells and run below code again and again to test code. I will be very grateful for any suggestions. The good news is it gives good output the bad news is I can't release it to my users until I quash this elusive little devil of a bug. I haven't thought of a way yet to really find out what's I'm thinking it's some kind of timing/hand-shaking issue where Excel is getting too many instructions too fast from Access and tripping over itself trying to keep up, but that's just my gut. May work fine one time and error out the next, or vise versa.Īlso noteworthy, when the error happens and I go into the Excel VBA debugger, if I click the little green triangle on the toolbar to resume execution, execution does resume, and the line that caused the error-opening the debugger-executes just fine as With no change to anything, a given figure The figures that error out are different each time. On a typical run, of 58 Figures, about 3 will throw this error-always at the same line.

The error comes at the fifth line up from the bottom: .Īccess calls this Excel macro once for each Figure. ThisWorkbook.Worksheets(FigNumber).ActivateĪctiveChart.Export ( & "\FigureImages\" & FigImg) Here's the snippet of VBA code that is misbehaving: Intermittently, after Access passes control to Excel, during execution of the Excel macro, Excel throws the "Excel cannot paste data" error. All of this works great.except sometimes. To control all this I'm using Access to get and process the data from SQL Server, drop individual values into the applicable cells in the Excel file that contains the "camera-ready" charts (Figures 1-60ish), and then call the Excel macro describedĪbove to make the Jpeg files. It then copies the picture and pastes it into a new Excel Chart with is then exported as a Jpeg file. A few cells are merged in most of the charts.Īn Excel macro selects the range containing a chart, copies the range, then pastes the range as a picture. Each chart is simply a small table of data about a particular topic-usually 8 to 10 columns wide and 10-15 rows. The Word document will contain several dozen linked Jpeg images that are created from a set of data charts inĮxcel.

The presentation will be a Word document.
#Microsoft excel cannot paste the data generator
I'm building a generator for our annual financial report. I'll try to be concise in describing the situation. I've read most of the posts under this title, but I am having this issue in a different context.
