Runtime Error: 2147024891

frank_AL

Active Member
Joined
Oct 30, 2015
Messages
467
I have code in a program that clears all data from all forms on all sheets.
As part of this program I execute the following code to delete all existing charts:

Dim wsItem As Worksheet
Dim chtObj As ChartObject


For Each wsItem In ThisWorkbook.Worksheets
For Each chtObj In wsItem.ChartObjects
chtObj.Delete
Next
Next
(Code I shamelessly copied from Mr. Excel or another Excel VBA Forum)

I have successfully run this code numerous times during development and repetitive testing sessions.
Now I am getting the following error message:
"Run-time error '-2147024891 (80070005)':
Access denied. You do not have enough privileges to complete this operation."

I have tried:
1. Closing the file and reopening
2. Closing Excel and reopening
3. Restarting my PC
4. Deleted existing Charts manually and re-created them (via other code modules)
to no avail. Any suggestions?
I Googled and found one Microsoft forum article but nothing in that article helped me.
https://social.technet.microsoft.co...50ad6/excel-2007-error-2147024891?forum=excel

The file in question resides on my local hard drive. I am running Excel 2016 on Windows 10.

After extensive testing of all program functionality this is the last hurdle before I can deliver to my customer.

Any/all help would be much appreciated!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Well, I figured out the issue! I had made a code change to select the 2 Worksheets that contained charts in order to delete other fields that existing on both Worksheets. Trying to delete Charts with more than 1 Worksheet selected appears to have been the problem. I resolved the issue by selecting a single Worksheet before running the chart delete code.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,428
Members
448,961
Latest member
nzskater

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