Hi,
I'm currently working on a fairly complex VBA project in Excel 2007. Basically though, I'm downloading information from a site, massaging it, creating a lot of graphs, saving them locally, deleting the chart from excel. I then save a copy of the workbook to a local file, clear the Spreadsheet, and then Do the same for information from another site.
When I had all of the code in one Module and ran it as a macro it ran flawlessly.
Now i've put the information into a Class. And am pretty much running the same process via a UserForm.
The problem I have though is that at any point after I execute the code: (and please assume that all variables have been declared, because they have)
I can no longer use this statement when moving a chart:
Even though I have created the chart and added it to the sheet and peformed various other operations on it by referencing ActiveChart
The Problem seems to lie in the Location method.
If I never "SaveCopyAs" then All the code runs fine, its just that as soon as I SaveCopyAs I can no longer change the location of a Chart:
If I debug the project I receive the error: run-time error 1004 - method 'location' of object '_Chart' failed.
at runtime. (If I then click "End") I get a File/Path Error, and then sometimes Excel crashes.
If I run the project as any user would, I receive the run-time error:
Error -2147417848 (&H80010108): The object invoked has disconnected from its clients.
And then Excel Crashes "Microsoft Office Excel has encountered a problem and needs to close. .... "
Any ideas on how to fix this? I'm assuming that after I saveCopyAs its losing a reference to something, and I've tried many things to fix this problem... all to no avail.
Please help,
Thanks,
Bookmarks