Converted from 2007 to 2010 Excel - Getting error on old code

bcurrey

Board Regular
Joined
Aug 11, 2011
Messages
110
Office Version
  1. 365
Platform
  1. MacOS
I have several queries running in the background of our system which export various pieces of data. Yesterday we finally upgraded the servers from Excel 2007 to 2010. Most of my macros are running fine. However, the code below errors out at the cht.Chart.Paste line. This code is basically looking at cells J23:J25, creating a picture, and then exporting it to my network folder. I would appreciate any help you guys can offer. I'm open to using other code, but so far haven't found anything that will work. Thanks!!!



Code:
Dim rng As Excel.Range
Dim cht As Excel.ChartObject
Const strPath As String = "D:\data\fci_queries\Real Time Stats\stats\wpimages\"
    
Application.ScreenUpdating = False
Set rng = Excel.Range("J23:J25").CurrentRegion
 
rng.CopyPicture xlScreen, xlPicture
Set cht = ActiveSheet.ChartObjects.Add(0, 0, rng.Width + 0.01, rng.Height + 0.01)
[B][COLOR=#ff0000]cht.Chart.Paste[/COLOR][/B]
cht.Chart.Export strPath & "queue.png"

cht.Delete
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,215,767
Messages
6,126,774
Members
449,336
Latest member
p17tootie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top